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: 5ms
Memory: 1092kB
Author: 2018212212308
In contest: 1273

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