mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
7a2a9109f5
2600-2699
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#include<stdio.h>
|
|
int main()
|
|
{
|
|
int n,i,k,j,a[11][11],b[11][11];
|
|
while(scanf("%d",&n)!=EOF){
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
scanf("%d",&a[i][j]);
|
|
scanf("%d",&k);
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
b[i][j]=(a[i][j]+a[j][n+1-i]+a[n+1-i][n+1-j]+a[n+1-j][i])*(k/4);
|
|
if(k%4==0)
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
b[i][j]+=a[i][j];
|
|
else if(k%4==1)
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
b[i][j]+=a[i][j]+a[n+1-j][i];
|
|
else if(k%4==2)
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
b[i][j]+=a[i][j]+a[n+1-j][i]+a[n+1-i][n+1-j];
|
|
else
|
|
for(i=1;i<=n;i++)
|
|
for(j=1;j<=n;j++)
|
|
b[i][j]+=a[i][j]+a[n+1-j][i]+a[n+1-i][n+1-j]+a[j][n+1-i];
|
|
for(i=1;i<=n;i++){
|
|
for(j=1;j<=n;j++){
|
|
printf("%d",b[i][j]);
|
|
if(j<n)
|
|
printf(" ");}
|
|
printf("\n");
|
|
}
|
|
}
|
|
}
|