103391: [Atcoder]ABC339 B - Langton's Takahashi

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

Description

Score: $250$ points

Problem Statement

There is a grid with $H$ rows and $W$ columns; initially, all cells are painted white. Let $(i, j)$ denote the cell at the $i$-th row from the top and the $j$-th column from the left.

This grid is considered to be toroidal. That is, $(i, 1)$ is to the right of $(i, W)$ for each $1 \leq i \leq H$, and $(1, j)$ is below $(H, j)$ for each $1 \leq j \leq W$.

Takahashi is at $(1, 1)$ and facing upwards. Print the color of each cell in the grid after Takahashi repeats the following operation $N$ times.

  • If the current cell is painted white, repaint it black, rotate $90^\circ$ clockwise, and move forward one cell in the direction he is facing. Otherwise, repaint the current cell white, rotate $90^\circ$ counterclockwise, and move forward one cell in the direction he is facing.

Constraints

  • $1 \leq H, W \leq 100$
  • $1 \leq N \leq 1000$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$H$ $W$ $N$

Output

Print $H$ lines. The $i$-th line should contain a string of length $W$ where the $j$-th character is . if the cell $(i, j)$ is painted white, and # if it is painted black.


Sample Input 1

3 4 5

Sample Output 1

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

The cells of the grid change as follows due to the operations:

....   #...   ##..   ##..   ##..   .#..
.... → .... → .... → .#.. → ##.. → ##..
....   ....   ....   ....   ....   ....

Sample Input 2

2 2 1000

Sample Output 2

..
..

Sample Input 3

10 10 10

Sample Output 3

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

Input

Output

分数:250分

问题描述

有一个网格,有$H$行和$W$列;最初,所有的格子都被涂成白色。用$(i, j)$表示从上数第$i$行、从左数第$j$列的格子。

这个网格被认为是环状的。也就是说,对于每个$1 \leq i \leq H$,$(i, 1)$在$(i, W)$的右边,对于每个$1 \leq j \leq W$,$(1, j)$在$(H, j)$的下方。

高桥最初在$(1, 1)$,面向上。在高桥重复以下操作$N$次后,输出网格中每个格子的颜色。

  • 如果当前格子被涂成白色,将它重新涂成黑色,顺时针旋转$90^\circ$,并按他面向的方向前进一个格子。否则,将当前格子重新涂成白色,逆时针旋转$90^\circ$,并按他面向的方向前进一个格子。

限制条件

  • $1 \leq H, W \leq 100$
  • $1 \leq N \leq 1000$
  • 所有的输入值都是整数。

输入

输入从标准输入给出以下格式:

$H$ $W$ $N$

输出

输出$H$行。第$i$行应包含一个长度为$W$的字符串,其中第$j$个字符是.,如果格子$(i, j)$被涂成白色,或者#,如果被涂成黑色。


样例输入1

3 4 5

样例输出1

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

由于操作,网格中的格子按以下方式变化:

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

加入题单

上一题 下一题 算法标签: