提示: 欢迎访问OurACM平台。
Problem 1859 Fractal II

Accept: 88    Submit: 194
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

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 Sierpinski fractal is defined as below:

  • A Sierpinski fractal of degree 1 is simply

    @

  • A Sierpinski fractal of degree 2 is

    @ @@

  • If using B(n-1) to represent the Sierpinski fractal of degree n-1, then a Sierpinski fractal of degree n is defined recursively as following

    B(n-1) B(n-1)B(n-1)

    Your task is to draw a Sierpinski fractal of degree n.

  • Input

    The input consists of several test cases. Each line of the input contains a positive integer n which is no greater than 10. The last line of input is an integer 0 indicating the end of input.

    Output

    For each test case, output the Sierpinski fractal using the '@' notation. Print a blank line after each test case. Don't output any trailing spaces at the end of each line, or you may get a PE!

    Sample Input

    1 2 0

    Sample Output

    @ @ @@

    Source

    FOJ有奖月赛-2009年11月

    Submit  Back  Status  Discuss