递推,注意初始化
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <string.h>
#include <math.h>
#include <stack>
#include <ctype.h>
using namespace std;
int m,n;
int dp[25][25];
int main()
{
cin >> m >> n;
for( int i = 1; i <= m; i++ )
for( int j = 1; j <= n; j++ )
{
if( i==1 || j==1 )
dp[i][j] = 1;
else
dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
cout << dp[m][n]<<endl;
return 0;
}