嗯,直接DP就好
状态转移为
(i%2!=0 && j%2!=0)ans[i][j]=ans[i-1][j]+ans[i][j-1];
#include<iostream>
#include<algorithm>
using namespace std;
const int N=35;
int ans[N][N];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
if(j%2==0 && i%2==0 )continue;
else if(i==1 && j==1)ans[i][j]=1;
else ans[i][j]=ans[i-1][j]+ans[i][j-1];
cout<<ans[n][m]<<endl;
return 0;
}