COCI '12 Contest 3 #1 Sahovnica

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 32M

Problem type

Mirko has become a hardcore patriot, so he has asked you to draw him a Croatian chessboard (checkerboard).

The chessboard consists of red and white cells. The upper left cell is red, with the remaining cells alternating between white and red in rows as well as columns. We will represent red areas with X characters, and white areas with . characters.

Mirko's chessboard should consist of R \times C cells, that is, R rows and C columns. Each row should be A characters high, and each column B characters wide. Consider the sample tests below for further clarification.

Input Specification

The first line of input contains two positive integers R and C (1 \le R, C \le 10) from the problem statement.

The second line of input contains two positive integers A and B (1 \le A, B \le 10) from the problem statement.

Output Specification

The output must consist of a total of R \times A rows and C \times B columns, forming the chessboard described above.

Sample Input 1

2 4
2 2

Sample Output 1

XX..XX..
XX..XX..
..XX..XX
..XX..XX

Sample Input 2

5 5
2 3

Sample Output 2

XXX...XXX...XXX
XXX...XXX...XXX
...XXX...XXX...
...XXX...XXX...
XXX...XXX...XXX
XXX...XXX...XXX
...XXX...XXX...
...XXX...XXX...
XXX...XXX...XXX
XXX...XXX...XXX

Comments

There are no comments at the moment.