标签:
4 4 0000 0000 0000 0000 4 4 0000 0010 0100 0000
Yes No
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char map[55][55];
int n,m;
int dfs(char map[55][55])
{
char temp[55][55];
int i,j,x,y;
for(i=1;i<n;i++)
{
for(j=1;j<m;j++)
{
if(map[i][j]=='0'&&map[i-1][j]=='0'&&map[i][j-1]=='0'&&map[i-1][j-1]=='0')
{
/*for(k=0;k<n;k++)
{
strcpy(map[k],temp[k]);
}*/
for(x=0;x<n;x++)
{
for(y=0;y<m;y++)
temp[x][y]=map[x][y];
}
temp[i][j]=temp[i-1][j]=temp[i-1][j-1]=temp[i][j-1]='1';
if(dfs(temp)==0)//能通向必败点的都是必胜点
return 1;
}
}
}
return 0;//只能通向必胜点的是必败点
}
int main()
{
//int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
int i,j;
for(i=0;i<n;i++)
{
// for(j=0;j<m;j++)
// {
scanf("%s",&map[i]);
// }
}
if(dfs(map))
printf("Yes\n");
else
printf("No\n");
}
}版权声明:本文为博主原创文章,未经博主允许不得转载。
HDOJ 题目1760 A New Tetris Game(DFS,博弈)
标签:
原文地址:http://blog.csdn.net/yu_ch_sh/article/details/47106779