简单dp问题,状态转移方程:f[i,j] += f[i - 1,j] + f[i,j - 1] (向右跟向下走)
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 35;
int n,m;
int f[N][N];
int main(){
scanf("%d%d",&n,&m);
f[1][1] = 1;
for(int i = 1;i <= n;++i){
for(int j = 1;j <= m;++j){
if(i & 1 || j & 1) f[i][j] += f[i - 1][j] + f[i][j - 1];
}
}
printf("%d\n",f[n][m]);
return 0;
}