mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1748.c
This commit is contained in:
parent
65aa82d8cd
commit
bc053a9ca0
29
QUSTOJ/1748.c
Normal file
29
QUSTOJ/1748.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include<stdio.h>
|
||||
int a[20][20];
|
||||
int main()
|
||||
{
|
||||
int n=0,i,j,k=1,p,q;
|
||||
scanf("%d",&n);
|
||||
i=0;
|
||||
j=n/2;
|
||||
for(p=0; p<n; p++)
|
||||
{
|
||||
for(q=0; q<n; q++)
|
||||
{
|
||||
if(q>0)
|
||||
{
|
||||
i=(i+n-1)%n;
|
||||
j=(j+1)%n;
|
||||
}
|
||||
a[i][j]=k++;
|
||||
}
|
||||
i=(i+1)%n;
|
||||
}
|
||||
for(i=0; i<n; i++)
|
||||
{
|
||||
for(j=0; j<n; j++)
|
||||
printf("%d ",a[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user