摘要: 1 #include 2 #include 3 #include 4 char map[110][110],cpy[110][110]; 5 int vis[110][110]; 6 7 int dx[4]={0,0,1,-1}; 8 int dy[4]={1,-1,0,0}; 9 10 int tdx[8]={0,0,1,-1,1,-1,1,-1};11 int tdy[8]={1,-1,0,0,1,1,-1,-1};12 int n,i,j,cnt1,cnt2;13 14 void dfs(int i,int j)15 {16 int k;17 for(k=0; k=... 阅读全文
posted @ 2013-05-23 08:53 水门 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 也是以前做的一个题,当时不会。bfs: 1 #include<stdio.h> 2 #include<string.h> 3 int a,b,c; 4 int vis[55][55][55],map[55][55][55]; 5 6 int dx[6]={0,0,0,0,-1,1}; 7 int dy[6]={0,0,1,-1,0,0}; 8 int dz[6]={1,-1,0,0,0,0}; 9 struct node10 {11 int x,y,z;12 int time1;13 }pos,npos,queue[55*55*55];14 15 int bfs()16 阅读全文
posted @ 2013-05-23 08:41 水门 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 以前做过的一个题,今天又做了一次。 1 #include 2 #include 3 #define maxn 2000 4 5 int u[maxn],v[maxn],bin[maxn]; 6 int find(int x) 7 { 8 return bin[x]==x?x:(bin[x]=find(bin[x])); 9 };10 11 int main()12 {13 int n,m,i,sum,x,y;14 while(~scanf("%d",&n)&&n)15 {16 sum=n-1;17 scanf("%d",& 阅读全文
posted @ 2013-05-23 08:36 水门 阅读(163) 评论(0) 推荐(0) 编辑