hdu 1364 Illusive Chase (dfs)

2015-07-20 17:34:36 · 作者: · 浏览: 3
# include 
  
   
# include 
   
     # include 
    
      # include 
     
       using namespace std; struct node { int x1; int x2; char x[5]; }; struct node a[100010]; int map[110][110]; int n,m,k; bool judge (int xx1,int yy1) { if(xx1<1||xx1>n||yy1<1||yy1>m) return 0; return 1; } int dfs(int x,int y,int cot) { int i,j; int fx,fy; if(cot==k) return true; for(i=1; i
      
>a[k].x; k++; } cot1=0; for(i=1; i<=n; i++) { for(j=1; j<=m; j++) { if(map[i][j]==0) { if(dfs(i,j,0)) cot1++; } } } printf("%d\n",cot1); } } return 0; }