from re import split def path_count(x,y): if x == 0 or y == 0: return 1 else: return path_count(x-1,y) + path_count(x,y-1) x, y = map(int, input().split()) print(path_count(x,y)) 当 x==0 或者 y ==0时,路径只能往右走或者往下走只有一条路。而[x,y]的路径是只能从[x-1, y]和[x,y-1]的路径过来。