2025年6月12日 星期四

矩陣轉換 II

 r,c,m = map(int,input().split())

    

d = []

for i in range(r):

  t = input().split()

  d.append(t)


mns = [int(i) for i in input().split()]

print(r,c)

for mn in mns:

  if mn==0:

    # print('右轉90') 

    d = [i[::-1] for i in zip(*d)]

    # for i in d:

      # print(i)

  if mn==1:

    # print('上下翻') 

    d = [i for i in d][::-1]

    # for i in d:

      # print(i)


for i in d:

  print(*i)


data

3 2 3

1 1

3 1

1 2

1 0 0


Output:


3 2

1 1

1 3

2 1

沒有留言:

張貼留言