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

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