sos大佬救救 python递归345超时
查看原帖
sos大佬救救 python递归345超时
816882
feixiao楼主2022/12/26 16:39

xb,yb,xh,yh = map(int,input().split()) h = [(xh-2,yh-1),(xh-2,yh+1),(xh-1,yh-2),(xh-1,yh+2),(xh+2,yh-1),(xh+2,yh+1),(xh+1,yh-2),(xh+1,yh+2),(xh,yh)] c = 0

def guohe(x,y): global c if x < xb: if (x+1,y) not in h: guohe(x+1,y) if y < yb: if (x,y+1) not in h: guohe(x,y+1) if x == xb and y == yb: c += 1

guohe(0,0) print(c)

2022/12/26 16:39
加载中...