Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Mathematics and Computer Science
螺旋方阵
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 243, Accepted users: 212
Problem 10475 : No special judgement
Problem description
  下面是一个5*5螺旋方阵。你的任务是输出逆时针方向旋进的n*n螺旋方阵。

1 16 15 14 13

2 17 24 23 12

3 18 25 22 11

4 19 20 21 10

5 6 7 8 9

Input
  输入文件只有一行,它是由若干个整数n组成的(少于50个数),每两个整数之间有一个空格,尾部无多余空格,(1<=n<=70)。

Output
  对输入文件中的每个整数n,先在一行上输出“n=”,再输出n的值。接着在下面的n行上按nn列的方式输出n*n螺旋方阵,行尾无空格,同一行上两个数之间空一格。两个螺旋方阵之间空一行。

Sample Input
4 5
Sample Output
n=4
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
 
n=5
1 16 15 14 13
2 17 24 23 12
3 18 25 22 11
4 19 20 21 10
5 6 7 8 9
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:184 today,10601757 total, since 2010-05-07