import numpy as np
def rotate90():
global v,b
b=np.rot90(b,1,(1,0))
def turn():
global v,b
for i in range(len(b)-1,-1,-1):
v.append(b[i])
b=v
a=list(map(int,input().split()))
b=[]
act=[]
v=[]
for i in range(a[0]):
b.append(list(map(int,input().split())))
for y in list(map(int,input().split())):
act.append(y)
for i in act:
if i==1:
turn()
elif i==0:
rotate90()
for x in range(len(b)):
for y in range(len(b[x])):
print(b[x][y],end=" ")
print()
import numpy as np
def rotate90():
global v,b
b=np.rot90(b,1,(1,0))
def turn():
global v,b
for i in range(len(b)-1,-1,-1):
v.append(b[i])
b=v
a=list(map(int,input().split()))
b=[]
act=[]
v=[]
for i in range(a[0]):
b.append(list(map(int,input().split())))
for y in list(map(int,input().split())):
act.append(y)for i in act:
if i==1:
turn()
elif i==0:
rotate90()
for x in range(len(b)):
for y in range(len(b[x])):
print(b[x][y],end=" ")
print()
不能用numpy,要自己寫