#abc250b. B - Enlarged Checker Board

B - Enlarged Checker Board

Score : 200200 points

问题描述

NN 行水平排列和 NN 列垂直排列中放置瓷砖。每个瓷砖上有 AA 行水平格子和 BB 列垂直格子。总体来说,这些瓷砖形成了一个网格 XX,具有 (A×N)(A\times N) 行水平格子和 (B×N)(B\times N) 列垂直格子。

对于 1i,jN1\leq i,j \leq N,第 (i,j)(i,j) 个瓷砖表示从上到下第 ii 行、从左到右第 jj 列的瓷砖。

XX 中的每个小方格按照以下方式涂色:

  • 每个瓷砖要么是 白色瓷砖 要么是 黑色瓷砖
  • 白色瓷砖中的所有小方格都涂成白色;黑色瓷砖中的所有小方格都涂成黑色。
  • 第一个瓷砖 (1,1)(1,1) 是白色瓷砖。
  • 共享边界的两个瓷砖颜色不同。这里,我们称瓷砖 (a,b)(a,b) 和瓷砖 (c,d)(c,d) 共享边界,当且仅当 ac+bd=1|a-c|+|b-d|=1(其中 x|x| 表示 xx 的绝对值)。

请按照输出部分指定的格式打印网格 XX

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Tiles are aligned in NN horizontal rows and NN vertical columns. Each tile has a grid with AA horizontal rows and BB vertical columns. On the whole, the tiles form a grid XX with (A×N)(A\times N) horizontal rows and (B×N)(B\times N) vertical columns.
For 1i,jN1\leq i,j \leq N, Tile (i,j)(i,j) denotes the tile at the ii-th row from the top and the jj-th column from the left.

Each square of XX is painted as follows.

  • Each tile is either a white tile or a black tile.
  • Every square in a white tile is painted white; every square in a black tile is painted black.
  • Tile (1,1)(1,1) is a white tile.
  • Two tiles sharing a side have different colors. Here, Tile (a,b)(a,b) and Tile (c,d)(c,d) are said to be sharing a side if and only if ac+bd=1|a-c|+|b-d|=1 (where x|x| denotes the absolute value of xx).

Print the grid XX in the format specified in the Output section.

Constraints

  • 1N,A,B101 \leq N,A,B \leq 10
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN AA BB

Output

Print (A×N)(A\times N) strings S1,,SA×NS_1,\ldots,S_{A\times N} that satisfy the following condition, with newlines in between.

  • Each of S1,,SA×NS_1,\ldots,S_{A\times N} is a string of length (B×N)(B\times N) consisting of . and #.
  • For each ii and jj (1iA×N,1jB×N)(1 \leq i \leq A\times N,1 \leq j \leq B\times N), the jj-th character of SiS_i is . if the square at the ii-th row from the top and jj-th column from the left in grid XX is painted white; the character is # if the square is painted black.

Sample Input 1

4 3 2

Sample Output 1

..##..##
..##..##
..##..##
##..##..
##..##..
##..##..
..##..##
..##..##
..##..##
##..##..
##..##..
##..##..

Sample Input 2

5 1 5

Sample Output 2

.....#####.....#####.....
#####.....#####.....#####
.....#####.....#####.....
#####.....#####.....#####
.....#####.....#####.....

Sample Input 3

4 4 1

Sample Output 3

.#.#
.#.#
.#.#
.#.#
#.#.
#.#.
#.#.
#.#.
.#.#
.#.#
.#.#
.#.#
#.#.
#.#.
#.#.
#.#.

Sample Input 4

1 4 4

Sample Output 4

....
....
....
....

update @ 2024/3/10 10:40:48