-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathb965.py
More file actions
36 lines (33 loc) · 1022 Bytes
/
b965.py
File metadata and controls
36 lines (33 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: sam0225
"""
while True:
try:
R, C, M = map(int, input().split())
pre = []
for i in range(R):
pre.append(list(map(int, input().split())))
op = list(map(int, input().split()))
for opm in range(M - 1, -1, -1):
if op[opm] == 0: # 逆旋轉
nxt = [[0] * R for i in range(C)]
for i in range(R):
for j in range(C):
nxt[C - 1 - j][i] = pre[i][j]
R, C = C, R
pre = nxt
else:
nxt = [[0] * C for i in range(R)]
for i in range(R):
for j in range(C):
nxt[R - 1 - i][j] = pre[i][j]
pre = nxt
print(str(R) + " " + str(C))
for i in range(len(pre)):
for j in range(len(pre[0])):
print(pre[i][j], end=" ")
print()
except:
break