P1320 - [蓝桥杯2017初赛]方格分割 - New Online Judgehttp://oj.ecustacm.cn/problem.php?id=1320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int ans=0;
int vis[8][8] = {0};
void dfs(int i, int j) {
if (i <= 0 || j <= 0 || i >= 6 || j >= 6) {
ans++;
return;
}
if (vis[i][j]) {
return;
}
vis[i][j] = 1;
vis[6-i][6-j] = 1;
dfs(i+1,j);
dfs(i,j+1);
dfs(i-1,j);
dfs(i,j-1);
vis[i][j] = 0;
vis[6-i][6-j] = 0;
}
int main() {
dfs(3, 3);
cout << ans/4;
return 0;
}