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: 54ms
Memory: 25432kB
Author: 13806858827
In contest: 1295

t=int(input())
s=0
while t>0:
    t1=input().split()
    n=int(t1[0])
    m=int(t1[1])
    k=int(t1[2])
    a=[[0]*m]*n
    for i in range(n):
        a[i]=[int(j) for j in input().split()]
    if s>0:print()
    s=s+1
    k=k%4
    if k==1:
        for j in range(m):
            for i in range(n-1,-1,-1):
                if i!=0:print(a[i][j],end=' ')
                else:print(a[i][j])
            
    elif k==2:
        for i in range(n-1,-1,-1):
            for j in range(m-1,-1,-1):
                if j!=0:print(a[i][j],end=' ')
                else:print(a[i][j])
    elif k==3:
        for j in range(m-1,-1,-1):
            for i in range(n):
                if i!=n-1:print(a[i][j],end=' ')
                else:print(a[i][j])
    else:
        for i in range(n):
            for j in range(m):
                if j!=m-1:print(a[i][j],end=' ')
                else:print(a[i][j])
    t=t-1