题解 | #走方格的方案数#DP
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
n, m = list(map(int,input().split())) dp = [[0 for _ in range(n+1)]for _ in range(m+1)] #dp[i][j]的含义为从左上角走到坐标为(i,j)的点的走法个数 for i in range(m+1): for j in range(n+1): if i == 0 or j == 0: dp[i][j] = 1 else: dp[i][j] =dp[i-1][j] + dp[i][j-1] print(dp[m][n])