本人水平有限,仅供学习,如有发现错误,感谢指出。
思路:不要搜索格点,不然很麻烦,搜索分隔线(要剪的线)即可,左右相同,上下相同,故除4
#include<bits/stdc++.h>
using namespace std;
//思路:不要搜索格点,不然很麻烦,搜索分隔线即可,左右相同,上下相同,故除4
int xx[4]={-1,1,0,0},yy[4]={0,0,-1,1},vis[7][7],res;
void dfs(int x,int y)
{
if(x<=0||x>=6||y<=0||y>=6){res++;return;}
for(int i=0; i<4; i++)
{
int tx = x+xx[i];
int ty = y+yy[i];
if(!vis[tx][ty] && !vis[6-tx][6-ty])
{
vis[tx][ty]=1;
vis[6-tx][6-ty]=1;
dfs(tx,ty);
vis[tx][ty]=0;//recall
vis[6-tx][6-ty]=0;//recall
}
}
}
int main()
{
vis[3][3]=1;
dfs(3,3);
res/=4;
return cout<<res<<endl,0;
}