1423: 蛇形填数(m*n)

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:89 Solved:25

Description

在m*n的方阵里填入1,2,...,m*n (0<m,n<=100),要求填成蛇形。
例如m=4;n=4时的方阵为:
10 11 12 1
9 16 13 2
8 15 14 3
7 6 5 4  
数据元素1的位置固定在第一行的第n列。

Input

输入只有一行,为两个正整数m和n,表示m*n的矩阵。

Output

为m*n的矩阵,每个数字占5个字符,且右对齐。

Sample Input Copy

4 4

Sample Output Copy

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

HINT

矩阵中每个元素的范围在-10^9到10^9之间。