#17574: NA 80% python 求解


chuang091@gmail.com (APCS實作400分)

學校 : 臺北市私立復興實驗高級中學
編號 : 96127
來源 : [60.250.123.203]
最後登入時間 :
2019-10-25 14:32:43
b266. 矩陣翻轉 -- 2016 APCS 實作題第二題 | From: [60.250.123.203] | 發表日期 : 2019-04-23 20:57

a = [int(s) for s in input().split()]
b=[]
for i in range(a[0]):
b.append([])
b[i]= [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
################################
def u(b):
tem=[]
for i in range(len(b)):
tem.append([])
tem[i]=b[(i+1)*-1]

return tem

################################
def n(b):
tem=[]
for i in range(len(b[0])):
tem.append([])
for j in range(len(b)):
tem[i].append(b[j][(i+1)*-1])
tem=u(tem)
return tem
################################
for i in range(len(c)):
if c[i]==1:
b=u(b)
if c[i]==0:
b=n(b)
for j in range(len(b)):
b[j].reverse()

################################
print(len(b),len(b[0]))
for i in range(len(b)):
for j in range(len(b[i])):
print(b[i][j],end=" ")
print()

 

 

 
ZeroJudge Forum