题解 | #走方格的方案数#
走方格的方案数
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)
查看16道真题和解析
