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: 135ms
Memory: 21432kB
Author: 13857575759
In contest: 1087

#!/usr/bin/python
# -*- coding: UTF-8 -*-
tcase=int(raw_input().strip())
for i in range(tcase):
    n,m,k=map(int,raw_input().strip().split())
    Matrix=[]
    for j in range(n):
        Matrix.append(map(int,raw_input().strip().split()))
    s=""
    for num in range(1,k+1):
        if num % 2==1:
            a=m
            b=n
        else:
            a=n
            b=m
        Matrix1=[[0 for i in range(b)] for j in range(a)]
        for i in range(a):
            for j in range(b):
                Matrix1[i][j]=Matrix[b-j-1][i]
        Matrix=Matrix1
    s=""
    for row in range(len(Matrix)):
        for col in range(len(Matrix[0])):
            print str(Matrix[row][col]),
        print
    print