这题是16年的国赛逆向题目
main函数如下
首先调用了两个函数来初始化,这里应该是初始化了一个22x22的矩阵
看下下面的验证函数
看了下,这里应该是一个走迷宫,从0,0走到21,21,一次只能往上下左右走,而且这一次向左右走了,下次只能往上下走
那么卡个断点,把矩阵给扒出来,之后跑个dfs只能跑出来答案
下面是dfs的代码
b=[0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1]
y=21
x=21
def find(x,y,v7):
if v7:
for i in range(22):
t=(x+i)%22
if(b[y*22+t]):
b[y*22+t]=0
if(t<=x):
return 'b'+chr(ord('e')+x-t),(t,y)
else:
return 'a'+chr(ord('e')+t-x),(t,y)
else:
for i in range(22):
t=(y+i)%22
if(b[t*22+x]):
b[t*22+x]=0
if(t<=y):
return 'd'+chr(ord('e')+y-t),(x,t)
else:
return 'c'+chr(ord('e')+t-y),(x,t)
return 'e'
b[y*22+x]=0
ans=[]
v=True
for i in range(40):
print(v)
r=find(x,y,v)
v=not v
tmp=r[0]
if(tmp[0]=='e'):
break
print(r)
x,y=r[1]
ans.append(tmp)
ans.reverse()
ans[1]='x'#这里这样做的原因是深搜到(0,19)又搜多了一步,搜到了(0,4)
print(''.join(ans))