5588: 【递归入门】骑士巡游问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:28 Solved:11

Description

输入 n ( 1< = n < = 10 ) 代表棋盘的规模就是 n*n 的规模,骑士永远从 (1,1) 出发,要求骑士不重复走遍所有棋盘的格子
输出 骑士的走法(遍历棋盘的所有格子) 

注意方向:
constintdx[8]={ -2,-2, -1, 1,2, 2, 1,-1};
constintdy[8]={ -1, 1,  2, 2,1,-1,-2,-2};

Output







Sample Input Copy

5

Sample Output Copy

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