DWITE Online Computer Programming Contest

LaNDscAPE ii

October 2008
Problem 1

A classic draw-some-ASCII-patterns problem turned onto its horizontal side. Let’s draw some hills of various heights.

The input file DATA1.txt will contain 5 lines, integers 0 ≤ N ≤ 5.

The output file OUT1.txt will contain 5 lines, which is the scene generated, as described below.

The background is drawn with periods (.). Hills are triangles in shape, with their height specified by the input, and are drawn with the letter x. Refer to the sample input.

Sample Input:
1
2
3
0
4
Sample Output:
.................
.............x...
......x.....xxx..
..x..xxx...xxxxx.
xxxxxxxxx.xxxxxxx