Fractal
http://poj.org/problem?id=2083
Time limit:1000ms
Memory limit:30000k
Description
A fractal is an object or quantity this displays self-similarity, in a somewhat technical, on all sense. The object need not exhibit exactly the same structure in all scales, but the same "type" of structures must in all Scales. A box fractal is defined as below:
A box fractal of degree 1 is simply X
A box fractal of degree 2 is x × x x x
If using B (n-1) to represent the box fractal of degree n-1, then a box fractal of degree n is defined recursively as F Ollowing
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 n.
Input
The input consists of several test cases. Each line of this input contains a positive integer n which is no greater than 7. The last line of type negative integer 1 indicating the end of input.
Output
For each test case, output the box fractal using the ' X ' notation. Please notice the ' X ' is a uppercase letter. Print a line with a single dash for each test case.
Sample Input
1234-1
Sample Output
X-x x xx x-x x x x XX x x x x x x x xx x x x x &NB Sp XX x x x-x x x x x x x x x x &N Bsp X XX x x x x x x x x x & nbsp x x x X x x X XX x x x x x x x x x x XX x x x x x x x &NBSP ; x x x x x x x x x x &NBSP ; x X X x X &N Bsp x x x x x x x x &N Bsp x XX x x x x x x x x x x XX x x x x x x x x x &N Bsp x x x X x x x XX x x x x x x x x x x XX x x x x x x x
Source
Shanghai Preliminary