这其实是一道DP题
#include <iostream>
#include <vector>
using namespace std;
int m, n;
int main(void) {
scanf("%d %d", &m, &n);
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 1));
int ans = 0;
for (int y = 1; y <= m; ++y)
for (int x = 1; x <= n; ++x)
dp[y][x] = dp[y][x - 1] + dp[y - 1][x];
printf("%d\n", dp[m][n]);
return 0;
}