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: 31ms
Memory: 1712kB
Author: 2018212212013
In contest: 1273

#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(){
	int T,n,m,k;
	int a[111][111],b[111][111];
	cin>>T;
	while(T--){
		cin>>n>>m>>k;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				cin>>a[i][j];
				if(k%4==0){
					b[i][j]=a[i][j];
				}
				if(k%4==1){
					b[j][n-1-i]=a[i][j];
				}
				if(k%4==3){
					b[m-1-j][i]=a[i][j];
				}
				if(k%4==2){
					b[n-1-i][m-1-j]=a[i][j];
				}
			}
		}
		if(k%4==1||k%4==3){
			for(int i=0;i<m;i++){
				for(int j=0;j<n;j++){
					cout<<b[i][j];
					if(j<=n-2)
						cout<<" ";
					else
						cout<<endl;
				}
			}
		}
		else{
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					cout<<b[i][j];
					if(j<=m-2)
						cout<<" ";
					else
						cout<<endl;
				}
			}
		}
		cout<<endl;
	}
	//system("pause");
	return 0;
}