POJ2876解题报告 递归
来源:互联网 发布:linux在终端中打开rpm 编辑:程序博客网 时间:2024/04/30 14:16
Cantoring Along
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2963 Accepted: 1608
Description
The Cantor set was discovered by Georg Cantor. It is one of the simpler fractals. It is the result of an infinite process, so for this program, printing an approximation of the whole set is enough. The following steps describe one way of obtaining the desired output for a given order Cantor set:
- Start with a string of dashes, with length 3order
- Replace the middle third of the line of dashes with spaces. You are left with two lines of dashes at each end of the original string.
- Replace the middle third of each line of dashes with spaces. Repeat until the lines consist of a single dash.
---------------------------Remove the middle third of the string:
--------- ---------and remove the middle third of each piece:
--- --- --- ---and again:
- - - - - - - -The process stops here, when the groups of dashes are all of length 1. You should not print the intermediate steps in your program. Only the final result, given by the last line above, should be displayed.
Input
Each line of input will be a single number between 0 and 12, inclusive, indicating the order of the approximation. The input stops when end-of-file is reached.
Output
You must output the approximation of the Cantor set, followed by a newline. There is no whitespace before or after your Cantor set approximation. The only characters that should appear on your line are '-' and ' '. Each set is followed by a newline, but there should be no extra newlines in your output.
Sample Input
0132
Sample Output
-- -- - - - - - - -- - - -
给定一个规则,输出相应的图形。。。纯递归
- POJ2876解题报告 递归
- POJ2876——递归
- POJ1088动态规划+递归解题报告
- 蓝桥杯 回型嵌套 递归 解题报告
- 蓝桥杯 砝码称重 递归 解题报告
- hdu 5326 - Work(递归)解题报告
- poj2876 预处理
- leetCode解题报告之构造二叉树(递归)
- Uva 10795 A Different Task 解题报告(递归+思维)
- UVa 254 - Towers of Hanoi 解题报告(递归)
- 蓝桥杯 购物券消费方案 递归暴力 解题报告
- 蓝桥杯 2的次幂表示 解题报告(递归)
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- cookie 和session的区别
- 点城市空气质量日报
- 中国互联网企业区域地图
- 串口通讯流控制
- POJ1089解题报告 区间合并
- POJ2876解题报告 递归
- csdn,我来了
- poj 3159 Candies
- gdb 调试-1
- poj 1273 Drainage Ditches
- 用CMake写一个简单的交叉编译测试工程
- 1740
- poj 1274 The Perfect Stall
- 1003:max sum