luogu#P10458. Fractal
Fractal
题目描述
A fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit exactly the same structure at all scales, but the same "type" of structures must appear on all scales.
A box fractal is defined as below :
- A box fractal of degree is simply X
- A box fractal of degree is
X X
X
X X
- If using to represent the box fractal of degree , then a box fractal of degree is defined recursively as following
B(n - 1) B(n - 1)
B(n - 1)
B(n - 1) B(n - 1)
Your task is to draw a box fractal of degree .
输入格式
The input consists of several test cases. Each line of the input contains a positive integer which is no greater than . The last line of input is a negative integer indicating the end of input.
输出格式
For each test case, output the box fractal using the 'X' notation. Please notice that 'X' is an uppercase letter. Print a line with only a single dash after each test case.
题目大意
【题目描述】
分形是在各种尺度上以某种技术意义上显示自相似性的对象或数量。对象不需要在所有尺度上展现完全相同的结构,但在所有尺度上必须出现相同的“类型”结构。
盒子分形定义如下:
- 度为 的盒子分形简单地是 X
- 度为 的盒子分形是
X X
X
X X
- 如果用 表示度为 的盒子分形,那么度为 的盒子分形可以递归地定义如下
B(n - 1) B(n - 1)
B(n - 1)
B(n - 1) B(n - 1)
你的任务是绘制度为 的盒子分形。
【输入格式】
输入包含多个测试用例。输入的每一行包含一个不大于 的正整数 。输入的最后一行是一个负整数 ,表示输入的结束。
【输出格式】
对于每个测试用例,使用 'X' 符号输出盒子分形。请注意,'X' 是一个大写字母。在每个测试用例之后打印一行仅包含单个破折号。
翻译来自于:ChatGPT。
1
2
3
4
-1
X
-
X X
X
X X
-
X X X X
X X
X X X X
X X
X
X X
X X X X
X X
X X X X
-
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X
X
X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
-