题解 | #走方格的方案数#
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
n,m = map(int,input().split()) def fun(x,y): if x==m and y==n: res.append(1) if x<m: fun(x+1,y) if y<n: fun(x,y+1) res = [] fun(0,0) print(sum(res))
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
n,m = map(int,input().split()) def fun(x,y): if x==m and y==n: res.append(1) if x<m: fun(x+1,y) if y<n: fun(x,y+1) res = [] fun(0,0) print(sum(res))
相关推荐