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. Given an m * n bitmap bmp, your job is to draw a "k-F bitmap of bmp". A "k-F bitmap of bmp" is made up of m * n sub-bitmap with blank bit in bmp replaced by blank region and no blank bit int bmp replaced by "(k-1)-F bitmap of bmp", and "1-F bitmap of bmp" is bmp itself. More details in sample.

Input

There will be multiple cases. Process to the End Of File.

Each case bigin with two positive integer m and n both less than 12, then a m * n bitmap bmp with trailing blanks if necessary. At last, a positive integer k no more than 12 indicate the desired bitmap.

Ouput

First ouput "Fractal #%d:" in a line where "%d" is the case id, ans output the answer to this case. Seperate cases with a blank line. No trailing blanks are allowed in the output.

Sample Input

1 3

4
3 3
X X
X
X X
3
6 6
+----+
| /\ |
|/ |
| /\ |
| \/ |
+----+
2
Sample Output

Fractal #1:

## ## ## ## ## ##

Fractal #2:
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

Fractal #3:
+----++----++----++----++----++----+
| /\ || /\ || /\ || /\ || /\ || /\ |
|/ ||/ ||/ ||/ ||/ ||/ |
| /\ || /\ || /\ || /\ || /\ || /\ |
| \/ || \/ || \/ || \/ || \/ || \/ |
+----++----++----++----++----++----+
+----+ +----++----+ +----+
| /\ | | /\ || /\ | | /\ |
|/ | |/ ||/ | |/ |
| /\ | | /\ || /\ | | /\ |
| \/ | | \/ || \/ | | \/ |
+----+ +----++----+ +----+
+----++----+ +----++----+
| /\ || /\ | | /\ || /\ |
|/ ||/ | |/ ||/ |
| /\ || /\ | | /\ || /\ |
| \/ || \/ | | \/ || \/ |
+----++----+ +----++----+
+----+ +----++----+ +----+
| /\ | | /\ || /\ | | /\ |
|/ | |/ ||/ | |/ |
| /\ | | /\ || /\ | | /\ |
| \/ | | \/ || \/ | | \/ |
+----+ +----++----+ +----+
+----+ +----++----+ +----+
| /\ | | /\ || /\ | | /\ |
|/ | |/ ||/ | |/ |
| /\ | | /\ || /\ | | /\ |
| \/ | | \/ || \/ | | \/ |
+----+ +----++----+ +----+
+----++----++----++----++----++----+
| /\ || /\ || /\ || /\ || /\ || /\ |
|/ ||/ ||/ ||/ ||/ ||/ |
| /\ || /\ || /\ || /\ || /\ || /\ |
| \/ || \/ || \/ || \/ || \/ || \/ |
+----++----++----++----++----++----+

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!