解题思路

动态规划

完整代码

x, y = map(int, input().split())

dp = [[1 for _ in range(y + 1)] for _ in range(x + 1)]
for i in range(1, x + 1):
  for j in range(1, y + 1):
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
print(dp[-1][-1])