题解 | #走方格的方案数#

走方格的方案数

https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b

n,m = list(map(int,input().split()))  # n为横向的格子数,m为竖向的格子数
def f(x,y):
    if x == 0 or y == 0:
        return 1  # 路径只有一条
    else:
        return (f(x-1,y) + f(x,y-1))

print(f(n,m))

全部评论

相关推荐

码农索隆:这种hr,建议全中国推广
点赞 评论 收藏
分享
06-05 19:46
已编辑
武汉大学 后端
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务