提交时间:2024-07-31 20:30:02

运行 ID: 49735

#include <bits/stdc++.h> using namespace std; int Map[35][35]={}; int a, b; int ans; void dfs(int x, int y) { if(x > 30 || y > 30 || !Map[x][y]) { return; } if(x == a && y == b) { ans++; return; } dfs(x+1, y); dfs(x, y+1); } int main(){ cin >> a >> b; for(int i=1; i<=30; i++) { for(int j=1; j<=30; j++) { if(i%2 || j%2) { Map[i][j] = 1; } } } if(a%2==0 && b%2==0) { cout << 0; return 0; } dfs(1, 1); cout << ans; return 0; }