Start: Apr, 17, 2017 10:00:00
Python程序设计基础培训第三次作业
End: Apr, 23, 2017 14:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 139ms
Memory: 21684kB
Author: 13777378855
In contest: 1087

tcase = int(raw_input().strip())  
for case in range(tcase): 
	n,m,k=map(int,raw_input().strip().split())
	myList = [[0] * m] * n
	for i in range(n):
		myList[i]=map(int,raw_input().strip().split())
	k=k%4
	s=''
	if k==0:
		for i in range(n):
			for j in range(m-1):
				s=s+str(myList[i][j])+' '
			s=s+str(myList[i][m-1])
			print s
			s=''
	if k==1:
		for i in range(m):
			for j in range(n-1,0,-1):
				s=s+str(myList[j][i])+' '
			s=s+str(myList[0][i])
			print s
			s=''
	if k==2:
		for i in range(n-1,-1,-1):
			for j in range(m-1,0,-1):
				s=s+str(myList[i][j])+' '
			s=s+str(myList[i][0])
			print s
			s=''
	if k==3:
		for i in range(m-1,-1,-1):
			for j in range(n-1):
				s=s+str(myList[j][i])+' '
			s=s+str(myList[n-1][i])
			print s
			s=''
	print