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: 29ms
Memory: 1836kB
Author: 2018212212122
In contest: 1273

#include <cstdio>
#include <iostream>
using namespace std;
int n,m,t,i,j,k,a[125][125],b[125][125],temp;
int main()
{
	cin>>t;
	while(t--){
		cin>>n>>m>>k;
		for(i=0;i<n;++i){
			for(j=0;j<m;++j){
				cin>>a[i][j];
			}
		}
		k%=4;
		while(k--)
		{
			for(i=n-1;i>=0;i--){
				for(j=0;j<m;++j){
					b[j][n-i-1]=a[i][j];
				}
			}
			temp=n;
			n=m;
			m=temp;
			for(i=0;i<n;++i){
				for(j=0;j<m;++j){
					a[i][j]=b[i][j];
				}
			}
		}
		for(i=0;i<n;++i){
			for(j=0;j<m-1;++j)
				cout<<a[i][j]<<" ";					
			cout<<a[i][m-1]<<endl;
		}
		cout<<endl;

	}

	return 0;
}