题解 | #走方格的方案数#
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
#动态规划
while 1:
try:
n,m=map(int,input().split(' '))
dp=[[1 for i in range(n+1)] for j in range(m+1)]
# print(dp) #[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(1,m+1):
for j in range(1,n+1):
dp[i][j]=dp[i-1][j]+dp[i][j-1]
print(dp[m][n])
except:
break
# # 递归
# def fun(x,y):
# if x<0 or y<0:
# return 0
# elif x==0 or y==0:
# return 1
# else:
# return fun(x-1,y)+fun(x,y-1)
# while 1:
# try:
# n,m=map(int,input().split(' '))
# res=fun(n,m)
# print(res)
# except:
# break