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

#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int i,j,k,t,n,m,a[100][100];
	cin >> t;
	while(t--)
	{
		cin >> n >> m >> k;
		for(i=0;i<n;i++)
			for (j=0;j<m;j++)
				cin >> a[i][j];
		switch(k%4)
		{
			
			case(1):
				for(j=0;j<m;j++)
					for (i=n-1;i>=0;i--)
						printf("%d%c",a[i][j]," \n"[i==0]);
				cout << "\n";
				break;
			case(2):
				for(i=n-1;i>=0;i--)
					for (j=m-1;j>=0;j--)
						printf("%d%c",a[i][j]," \n"[j==0]);
				cout << "\n";
				break;
			case(3):
				for(j=m-1;j>=0;j--)
					for (i=0;i<n;i++)
						printf("%d%c",a[i][j]," \n"[i==n-1]);
				cout << "\n";
				break;
			case(0):
				for(i=0;i<n;i++)
					for (j=0;j<m;j++)
						printf("%d%c",a[i][j]," \n"[j==m-1]);
				cout << "\n";
				break;				
		}
	}
}