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: 24ms
Memory: 1748kB
Author: 2018212212048
In contest: 1273

#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	int t;
	int n,m,k;
	int flag=1;
	int a[200][200];
	cin>>t;
	while(t--){
		cin>>n>>m>>k;
		if(flag==0) cout<<endl;
		flag=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				cin>>a[i][j];
			}
		}
		if(k%4==0){
			for(int i=1;i<=n;i++){
				for(int j=1;j<=m;j++){
					cout<<a[i][j];
					if(j==m) cout<<endl;
					else cout<<" ";
				}
			}
		}
		else if(k%4==1){
			for(int i=1;i<=m;i++){
				for(int j=n;j>=1;j--){
					cout<<a[j][i];
					if(j==1) cout<<endl;
					else cout<<" ";
				}
			}
		}
		else if(k%4==2){
			for(int i=n;i>=1;i--){
				for(int j=m;j>=1;j--){
					cout<<a[i][j];
					if(j==1) cout<<endl;
					else cout<<" ";
				}
			}
		}
		else{
			for(int i=m;i>=1;i--){
				for(int j=1;j<=n;j++){
					cout<<a[j][i];
					if(j==n) cout<<endl;
					else cout<<" ";
				} 
			}
		}
	}
}