1555: 【c11】格子填数█

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:9 Solved:8

Description

在一个N×N(N <= 8)的方阵中,填入1,2……,N×N个数。

假如N是5,要求构成如下蛇形。


Input

输入一个正整数n,n <= 8

Output

输出n×n的方阵蛇形图,每个数字占4个宽度。

Sample Input Copy

5

Sample Output Copy

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