102501: [AtCoder]ABC250 B - Enlarged Checker Board

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

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

Each square of $X$ 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)$ is a white tile.
  • Two tiles sharing a side have different colors. Here, Tile $(a,b)$ and Tile $(c,d)$ are said to be sharing a side if and only if $|a-c|+|b-d|=1$ (where $|x|$ denotes the absolute value of $x$).

Print the grid $X$ in the format specified in the Output section.

Constraints

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

Input

Input is given from Standard Input in the following format:

$N$ $A$ $B$

Output

Print $(A\times N)$ strings $S_1,\ldots,S_{A\times N}$ that satisfy the following condition, with newlines in between.

  • Each of $S_1,\ldots,S_{A\times N}$ is a string of length $(B\times N)$ consisting of . and #.
  • For each $i$ and $j$ $(1 \leq i \leq A\times N,1 \leq j \leq B\times N)$, the $j$-th character of $S_i$ is . if the square at the $i$-th row from the top and $j$-th column from the left in grid $X$ 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

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

Input

题意翻译

你需要填一个 $n\times a$ 行,$n\times b$ 列的矩阵,用 `#` 和 `.` 代替黑色和白色,规则如下: - 每个方格 $a$ 行 $b$ 列。 - 方格中颜色一致。 - 相邻的方格颜色不同。 - 左上角的方格为白色。 请输出方格。 简要题意:请输出 $n^2$ 个 $a$ 行 $b$ 列的方格的图案,要求相邻方格颜色相反。

Output

分数:200分

问题描述

将瓷砖排列成$N$行$N$列。每一块瓷砖有一个$A$行$B$列的网格。总的来说,这些瓷砖形成一个网格$X$,有$(A\times N)$行和$(B\times N)$列。

对于$1\leq i,j \leq N$,Tile $(i,j)$表示从上数第$i$行和从左数第$j$列的瓷砖。

每个$X$的方格都按照以下方式涂色。

  • 每一块瓷砖是白色瓷砖或黑色瓷砖。
  • 白色瓷砖中的每个方格都涂成白色;黑色瓷砖中的每个方格都涂成黑色。
  • Tile $(1,1)$是白色瓷砖。
  • 相邻的两块瓷砖颜色不同。这里,Tile $(a,b)$和Tile $(c,d)$被认为是相邻的,如果且仅如果$|a-c|+|b-d|=1$(其中$|x|$表示$x$的绝对值)。

按照输出部分指定的格式打印网格$X$。

限制条件

  • $1 \leq N,A,B \leq 10$
  • 输入中的所有值都是整数。

输入

输入从标准输入给出,格式如下:

$N$ $A$ $B$

输出

打印$S_1,\ldots,S_{A\times N}$,这些字符串满足以下条件,之间用换行符分隔。

  • 每个$S_1,\ldots,S_{A\times N}$都是一个长度为$(B\times N)$的字符串,由.#组成。
  • 对于每个$i$和$j$ $(1 \leq i \leq A\times N,1 \leq j \leq B\times N)$,$S_i$的第$j$个字符是.,如果网格$X$中从上数第$i$行和从左数第$j$列的方格涂成白色;如果方格涂成黑色,则字符为#

样例输入1

4 3 2

样例输出1

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

样例输入2

5 1 5

样例输出2

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

样例输入3

4 4 1

样例输出3

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

样例输入4

1 4 4

样例输出4

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

加入题单

算法标签: