[原创]分形问题 递归打印解决 另附hrbust 2291 题目
[原创]分形问题 递归打印解决 另附hrbust 2291 题目
2015-12-12 13:06:01 Tabris_ 阅读数:990
博客爬取于2020-06-14 22:45:19
以下为正文
版权声明:本文为Tabris原创文章,未经博主允许不得私自转载。
https://blog.csdn.net/qq_33184171/article/details/50274193
Help C5
Time Limit: 1000 MS
Memory Limit: 65535 K
Total Submit: 51(9 users)
Total Accepted: 12(8 users)
Rating:
Special Judge: No
Description
Hello, I’m Sea5, and you can call me C5 instead. I want a program which can sign my name automatically. And my brothers, C0, C1, C2, C3, C4, C6, C7, C8, each of them wants one as well. Can you help us?
Input
First line is the number of test cases T(T<=8).
T lines follow, each line includes an integer N(N<=7), and you should help C(N) to sign his name.
Output
C0’s signature is ‘C’.
When you draw C(N)’s name, you should print the name using C(N-1)’s name as its element, and using the following format to draw it.
*XX
X**
*XX
(X is the element, * is blank space)
And please don’t print extra spaces at the end of line.
For example, C1’s name should be
1 | *CC *CC |
(I use * to show you where are spaces.)
Sample Input
1 | 3 |
Sample Output
1 | C |
本类型题其实就是模版体 比赛的时候有模版还是很好做的 (其实没有模版也不难)
最主要的是格式 对输出图形空格的格式 以及没两组输出后又没有空格等
对不同的图行 只要找到相应的位置不断的递归就可以了
其实也可以先把所有的图形都打印下来 然后在选取部分输出就好了
附本题代码
1 |
|