Problem4855--打印蛇形方阵

4855: 打印蛇形方阵

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

打印一个 $n \times n\ (1 \leq n \leq 100)$ 的数字方阵。
例如 $n=4$ 时:
1  3   4   10
2  5   9   11
6  8   12  15
7  13  14  16

Input

输入 $n$。

Output

输出 $n \times n$ 的方阵。

Sample 1 Input

4

Sample 1 Output

1 3 4 10
2 5 9 11
6 8 12 15
7 13 14 16

Sample 2 Input

5

Sample 2 Output

1 3 4 10 11 
2 5 9 12 19 
6 8 13 18 20 
7 14 17 21 24 
15 16 22 23 25 

Sample 3 Input

2

Sample 3 Output

1 3 
2 4 

6

1 3 4 10 11 21 
2 5 9 12 20 22 
6 8 13 19 23 30 
7 14 18 24 29 31 
15 17 25 28 32 35 
16 26 27 33 34 36 

Source/Category