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

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