Start: Jun, 26, 2019 08:30:00
2019年度暑期短学期第一天
End: Jun, 26, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 6ms
Memory: 1092kB
Author: 2018212212182
In contest: 1273

#include <stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--){
int n,m,k;
scanf("%d %d %d",&n,&m,&k);
int array[100][100],i,j;
 for(i=0;i<n;i++){
   for(j=0;j<m;j++){
   scanf("%d",&array[i][j]);
   }
 }
 if(k%4==1){
  for(i=0;i<m;i++){
   for(j=n-1;j>=0;j--){
	   if(j!=0)
  printf("%d ",array[j][i]);
	   else
 printf("%d\n",array[j][i]);
   }
  }
 }
 else if(k%4==2){
  for(i=n-1;i>=0;i--){
   for(j=m-1;j>=0;j--){
	   if(j!=0)
  printf("%d ",array[i][j]);
	   else
printf("%d\n",array[i][j]);
   }
 }
}
 else if(k%4==3){
  for(i=m-1;i>=0;i--){
   for(j=0;j<n;j++){
	   if(j!=n-1)
  printf("%d ",array[j][i]);
	   else
 printf("%d\n",array[j][i]);
   }
 }
 }
 else if(k%4==0){
  for(i=0;i<n;i++){
   for(j=0;j<m;j++){
	   if(j!=m-1)
  printf("%d ",array[i][j]);
	   else
printf("%d\n",array[i][j]);
   }
 }
 }
 if(T!=0)
	 printf("\n");
}
return 0;
}