1523: 蛇形填数

Memory Limit:128 MB Time Limit:50.000 S
Judge Style:Text Compare Creator:
Submit:48 Solved:21

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  

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

Source/Category