https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=9
#Description
首先给你两个N*N的矩阵,然后告诉你认识的单词,具体题目就会懂.如果看过冒险小虎队那就更懂了.
#Algorithm
就是模拟,然后一点字符串操作,当然了,这些对python来说都不是事
一行矩阵旋转90度代码
g = list(zip(*g[::-1]))
#Code
def solve():
n = int(input())
g1 = []
for i in range(n):
g1.append(list(input()))
g2 = []
for i in range(n):
g2.append(list(input()))
m = int(input())
st = set()
for i in range(m):
st.add(input())
ss = []
for i in range(4):
s = []
for j in range(n):
for k in range(n):
if g2[j][k] == '*':
s.append(g1[j][k])
g2 = list(zip(*g2[::-1]))
ss.append(s)
sss = []
for i in range(4):
s = ""
for j in range(4):
s += "".join(ss[(i + j) % 4])
y = list(filter(None, s.split('.')))
sss.append(y)
sss.sort()
for ee in sss:
flag = True
for e in ee:
if e not in st:
flag = False
break
if flag:
return " ".join(ee)
return "FAIL TO DECRYPT"
t = int(input())
for i in range(1, t + 1):
print("Case #{}: {}".format(i, solve()))