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: 6ms
Memory: 1092kB
Author: 2018212212189
In contest: 1273

#include<stdio.h>
const int maxn=101;
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int a[maxn][maxn];
		int n, m, k,i,j;
		scanf("%d%d%d", &n,&m,&k);
		k = k % 4;
		for (i = 0; i < n;++i)
		for (j = 0; j < m; ++j)
			scanf("%d", &a[i][j]);
		if (k == 1)
		{																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											
			for (i = 0; i < m; ++i){
				for (j = n - 1; j >= 0; j--){
					printf("%d ", a[j][i]);
				}
				printf("\n");
			}
			printf("\n");
		}
		if (k == 2)
		{
			for (i =n-1; i>=0; --i)
			{
				for (j = m-1; j>=0; --j)
				{
					printf("%d ", a[i][j]);
				}
				printf("\n");
			}
			printf("\n");
		}
		if (k == 3)
		{
			for (i = m-1; i >=0; --i)
			{
				for (j = 0; j < n; ++j)
				{
					printf("%d ", a[j][i]);
				}
				printf("\n");
			}
			printf("\n");
		}
		if (k == 0)
		{
			for (i = 0; i < n; ++i)
			{
				for (j = 0; j < m; ++j)
				{
					printf("%d ", a[i][j]);
				}
				printf("\n");
			}
			printf("\n");
		}
	}
}