Start: Jul, 17, 2019 00:00:00
20190717Python程序设计基础培训第三次作业
End: Jul, 21, 2019 00:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 52ms
Memory: 25184kB
Author: shanzhenyu
In contest: 1295

def rotate(a):
    row,col = len(a),len(a[0])
    c = [[0 for j in range(row)] for i in range(col)]
    for i in range(col):
        for j  in range(row):
            c[i][j] = a[row-j-1][i]
    return c;
    
for tcase in range(int(input())):
    n,m,k = map(int,input().split())
    a,k = [],k%4
    for i in range(n):
        a.append(list(map(int,input().split())))

    for i in range(k):
        a = rotate(a)
        
    for i in range(len(a)):
        for j in range(len(a[0])-1):
            print(a[i][j],end = " ")
        print(a[i][len(a[0])-1])
    print()