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: 2018212212310
In contest: 1273

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