原题链接https://www.luogu.com.cn/problem/P8707
遍历一遍就行
数据范围小,能够暴力
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <tuple>
#include <vector>
#define ll long long
const ll N = 100 + 10;
ll n,m;
ll op[N];
ll dp[N][N];
ll dx[] = {0,-1};
ll dy[] = {-1,0};
void solve(){
std::cin >> n >> m;
std::memset(dp,0,sizeof dp);
dp[1][1] = 1;
for(ll i = 1; i <= n; i ++){
dp[i][1] = 1;
}
for(ll j = 1; j <= m; j ++){
dp[1][j] = 1;
}
for(ll i = 2; i <= n; i ++){
for(ll j = 2; j <= m; j ++){
if(i % 2 == 0 && j % 2 == 0){
dp[i][j] = 0;
continue;
}
for(ll h = 0; h <= 1; h ++){
ll xx = dx[h] + i;
ll yy = dy[h] + j;
// if(xx >= 1 && xx <= n && yy >= 1 && yy <= m){
dp[i][j] += dp[xx][yy];
// }
}
}
}
// for(ll i = 1; i <= n; i ++){
// for(ll j = 1; j <= m; j ++){
// std::cout << dp[i][j] << " ";
// }
// std::cout << "\n";
// }
std::cout << dp[n][m] << "\n";
return ;
}
int main(){
ll t = 1;
while(t --)
solve();
return 0;
}