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: 8ms
Memory: 1892kB
Author: 2018212212127
In contest: 1273

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
const int maxn=150;
int a[maxn][maxn],b[maxn][maxn];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n,m,k;
		scanf("%d %d %d",&n,&m,&k);
		k%=4;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				scanf("%d",&a[i][j]);
			}
		}
		while(k--){
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					b[j][n-i-1]=a[i][j];
				}
			}
			swap(n,m);
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++) a[i][j]=b[i][j];
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++) printf("%d%c",a[i][j]," \n"[j==m-1]);
		}
		if(t!=0) printf("\n");
	} 
}