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: 50ms
Memory: 25184kB
Author: 13600513276
In contest: 1295

for s in range(int(input())):
    row,col,k=map(int,input().split())
    a=[[0 for j in range(col)]for i in range(row) ]
    for i in range(row):
        s=list(map(int,input().split()))
        for j in range(col):
            a[i][j]=s[j]
    b=[[0 for j in range(row)]for i in range(col) ]
    if k%4==1:
        b=[[a[row-j-1][i] for j in range(row)]for i in range(col) ]
    elif k%4==2:
        b=[[a[row-i-1][col-j-1] for j in range(col)]for i in range(row) ]
    elif k%4==3:
        b=[[a[j][col-i-1] for j in range(row)]for i in range(col) ]
    elif k%4==0:
        b=a
    for n in b:
        for m in n[:-1]:
            print(m,end=" ")
        print(n[-1])
    print()