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

走方格的方案数

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

import sys
re = 0
for line in sys.stdin:
    a = list(map(int,line.strip().split(" ")))
def goto(g1,g2):
    global re
    if g1 +1 <= a[0]:
        goto(g1+1,g2)
    if g2+1 <= a[1]:
        goto(g1,g2+1)
    if g1 == a[0] and g2 == a[1]:
        re+=1
goto(0,0)
print(re)


全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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