#include<bits/stdc++.h>
using namespace std;
const int maxn = 6;
int ans=0;
int mapp[7][7];
int dir[4][2]={0,1,1,0,0,-1,-1,0};
void dfs(int x,int y)
{
if(x==0||y==0||x==maxn||y==maxn)
{
return;
}
for(int i=0;i<4;i++)
{
int tx = x+dir[i][0];
int ty = y+dir[i][1];
if(mapp[tx][ty])
{
continue;
}
mapp[tx][ty]=1;
mapp[maxn-tx][maxn-ty]=1;
dfs(tx,ty);
mapp[tx][ty]=0;
mapp[maxn-tx][maxn-ty]=0;
}
}
int main()
{
memset(mapp,0,sizeof(mapp));
mapp[maxn/2][maxn/2]=1;
dfs(maxn/2,maxn/2);
printf("%d\n",ans/4);
return 0;
}
方格分割(两个方向同时dfs)
最新推荐文章于 2020-01-08 18:29:02 发布