#abc357c. C - Sierpinski carpet
C - Sierpinski carpet
Score : points
问题陈述
对于一个非负整数 ,我们定义一个 级地毯如下:
- 一个 级地毯是一个 的网格,由一个单独的黑色单元格组成。
- 对于 ,一个 级地毯是一个 的网格。当这个网格被划分为九个 的区块时:
- 中心区块完全由白色单元格组成。
- 其他八个区块是 级地毯。
你给定一个非负整数 。 请按照指定的格式打印一个 级地毯。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
For a non-negative integer , we define a level- carpet as follows:
- A level- carpet is a grid consisting of a single black cell.
- For , a level- carpet is a grid. When this grid is divided into nine blocks:
- The central block consists entirely of white cells.
- The other eight blocks are level- carpets.
You are given a non-negative integer .
Print a level- carpet according to the specified format.
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
The -th line () should contain a string of length consisting of .
and #
.
The -th character of () should be #
if the cell at the -th row from the top and -th column from the left of a level- carpet is black, and .
if it is white.
Sample Input 1
1
Sample Output 1
###
#.#
###
A level- carpet is a grid as follows:
When output according to the specified format, it looks like the sample output.
Sample Input 2
2
Sample Output 2
#########
#.##.##.#
#########
###...###
#.#...#.#
###...###
#########
#.##.##.#
#########
A level- carpet is a grid.