Олимпиадный тренинг

Задача 42230. Large chess board


Задача

Темы: Вложенные циклы
The tiles are aligned to N horizontal rows and N vertical columns. Each tile has a grid with A horizontal rows and B vertical columns. All tiles form a square with (A×N) horizontal lines and (B×N) in vertical columns.
For 1<= i, j<= N tile (ij) designates the tile in the i-th row from the top and the j-th column from the left.

Each X square is colored as follows.
  • Each tile is either a white tile or a black tile.
  • Each square in a white tile is colored white; each square in a black tile is colored black.
  • Tile (11) is a white tile.
  • The two tiles that share the same side have different colors. Tile (ab) and tile (cd), have one common side if and only if |a-c|+|b-d|=1 (where |x| denotes the absolute value of < code>x).
Print the X square in the format specified in format.

Input
The program receives three integers as input: N, A, B (1 <= N, A, B <= 10).

Imprint
Print (A×N) strings S1,...,SAxN that satisfy the following conditions.
Each of the strings S1,...,SAxN is a string of length (B× N) consisting of . and #.
For each value i and j (1<= i <= A×N,1 <= j <= B×N) jth character of the string Si is the character . if the square is in the ith string top and left j-th column in X square is colored white; symbol # if the square is black.
 
 
Examples
# Input Output
1
4 3 2
..##..##
..##..##
..##..##
##..##..
##..##..
##..##..
..##..##
..##..##
..##..##
##..##..
##..##..
##..##..
2
5 1 5
.....#####.....#####.....
#####.....#####.....#####
.....#####.....#####.....
#####.....#####.....#####
.....#####.....#####.....
3
4 4 1
.#.#
.#.#
.#.#
.#.#
#.#.
#.#.
#.#.
#.#.
.#.#
.#.#
.#.#
.#.#
#.#.
#.#.
#.#.
#.#.
4
1 4 4
....
....
....
....