13628 - Elsa's curse   

Description

“W… Why did I…?”

Elsa crushed the paper in her hand, her eyes brimming with tears. Her grade on the I2P course has been marked with an F. She stormed into the raging blizzard, swearing not to return to programming again. Since then, the blizzard never seemed to cease.

Years passed, and the city of Arendrelle suffered from the everlasting winter caused by Elsa’s magic. To save the town, her sister Anna managed to reach Elsa’s ice castle. From what she had known from the trolls, the only way to stop Elsa’s magic is to make her reunite with programming again. Therefore, Anna decided to make Elsa a program that makes a snowflake from a number. Please help her make it.

A snowflake of order n is composed of the character ‘#’ and spaces. In the middle is the largest square, aka 'central square.' In each corner is a snowflake of order n-1 whose central square touches the main central square in its corner, and in the middle of each edge is a snowflake of order n-2 whose central square touches the main central square on its edge.

These snowflakes are 1 pixel apart from each other. (Look at Figure 1 for reference)

The smallest snowflake is of size 1×1 pixel, aka. order 1 snowflake.

The snowflake with size 0, although not a snowflake, is called order 0 by convention.

Remember to print '\n' at the end of every line.

Figure 1 Snowflakes of orders 1, 2, 3, 4, and 5.

 

To help you with some math, we provide you with the code for generating the size of the middle square and the cumulative sum of the square sizes up to order 7, as well as the size of the snowflake. You can try to verify the code by yourself.

Input

An integer n

1 < n < 7

Output

The snowflake of order n.

Sample Input  Download

Sample Output  Download

Tags

Recursive Fractal



Discuss