1. 程式人生 > >Codeforces 448C:Painting Fence 刷柵欄 超級好玩的一道題目

Codeforces 448C:Painting Fence 刷柵欄 超級好玩的一道題目

Note

In the first sample you need to paint the fence in three strokes with the brush: the first stroke goes on height 1 horizontally along all the planks. The second stroke goes on height 2 horizontally and paints the first and second planks and the third stroke (it can be horizontal and vertical) finishes painting the fourth plank.

In the second sample you can paint the fence with two strokes, either two horizontal or two vertical strokes.

In the third sample there is only one plank that can be painted using a single vertical stroke.