Given a number
n
. Create an array
A[2*n+1][2*n+1]
and fill it in a spiral, starting with the number
0
in the center cell ;
A[n+1][n+1]
. The spiral goes up, then twists counterclockwise.
Input
The program receives a number as input
n
.
Imprint
The program should output the resulting array, using exactly 3 characters for each number.
Examples
# |
Input |
Output |
1 |
2 |
12 11 10 9 24
13 2 1 8 23
14 3 0 7 22
15 4 5 6 21
16 17 18 19 20
|