螺旋方阵
Time Limit: 1000 ms Memory Limit: 65536 KiB
Submit Statistic Discuss
Problem Description
n×n的螺旋方阵当n=5和n=3时分别是如下的形式
请给出一个程序,对于任意的输入n(0<n<11),输出按照上面规律所获得的n×n的螺旋方阵。
Input
输入第一行为整数m(0<m<10),代表有m组输入;
接下来是m行数据,每行输入一个n(0<n<11)。
Output
按照输入的次序,依次输出每一个n×n方阵(一个方阵的同一行数据之间以’\t’分隔)
两个输出方阵之间输出一个空行。
Sample Input
1
4
Sample Output
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
Hint
Source
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void f(int n);
int tp,cn;
int a[14][