P8707 [蓝桥杯 2020 省 AB1] 走方格 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 2e5+10,M = 1e2+10;
int f[M][M];
signed main()
{
std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,m;cin>>n>>m;
f[1][1] = 1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
f[i][j]+=f[i-1][j];
f[i][j]+=f[i][j-1];
if(i%2==0&&j%2==0)f[i][j]=0;
}
}
cout<<f[n][m];
return 0;
}