<center style="color&#58;rgb&#40;51&#44;51&#44;51&#41;&#59;font&#45;family&#58;&#39;Helvetica Neue&#39;&#44; Helvetica&#44; Arial&#44; sans&#45;serif&#59;font&#45;size&#58;14px&#59;background&#45;color&#58;rgb&#40;255&#44;255&#44;255&#41;&#59;"> </center> <center style="color&#58;rgb&#40;51&#44;51&#44;51&#41;&#59;font&#45;family&#58;&#39;Helvetica Neue&#39;&#44; Helvetica&#44; Arial&#44; sans&#45;serif&#59;font&#45;size&#58;14px&#59;background&#45;color&#58;rgb&#40;255&#44;255&#44;255&#41;&#59;">

问题 H: 旋转图像

时间限制: 1 Sec   内存限制: 128 MB
</center>

题目描述

输入

输出

样例输入

2
2 3
111
000
90
3 3
111
101
111
180

样例输出

01
01
01
111
101
111
#include <stdio.h>
char s[55][55];
int main()
{
	int n, m, t, angle;
	while (~scanf("%d", &t))
	{
		while (t--)
		{
			scanf("%d%d%*c", &n, &m);
			for (int i = 0; i < n; i++)
				scanf("%s", s[i]);
			scanf("%d%*c", &angle);
			if (angle == 0)
			{
				for (int i = 0; i < n; i++)
				{
					for (int j = 0; j < m; j++)
						printf("%c", s[i][j]);
					puts("");
				}
			}
			else if (angle == 90)
			{
				for (int j = 0; j < m; j++)
				{
					for (int i = n - 1; i >= 0; i--)
						printf("%c", s[i][j]);
					puts("");
				}
			}
			else if (angle == 180)
			{
				for (int i = n - 1; i >= 0; i--)
				{
					for (int j = m - 1; j >= 0; j--)
						printf("%c", s[i][j]);
					puts("");
				}
			}
			else if (angle == 270)
			{
				for (int j = m - 1; j >= 0; j--)
				{
					for (int i = 0; i < n; i++)
						printf("%c", s[i][j]);
					puts("");
				}
			}
		}
	}
	return 0;
}