Start: Nov, 12, 2017 10:00:00
2017秋Python程序设计基础培训第三次作业
End: Nov, 19, 2017 12:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 110ms
Memory: 24532kB
Author: lijian3256
In contest: 1123

t = eval(input())
a = [[0 for x in range(100)] for y in range(100)]
b = [[0 for x in range(100)] for y in range(100)] 
for _t in range(t):
        n, m, k = map(int, input().split())
        k = k % 4
        for i in range(n):
                x = list(map(int,input().split()))
                for j in range(m):
                        a[i][j] = x[j]
        for _k in range(k):
                for i in range(n):
                        for j in range(m):
                                b[j][n-i-1] = a[i][j]   
                for i in range(m):
                        for j in range(n):
                                a[i][j] = b[i][j]
                tmp = m
                m = n
                n = tmp
                
        for i in range(n):
                for j in range(m):
                        print(a[i][j], end = " ")
                print()
        print()