摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2514DFS我的代码 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 int a[10],cnt,ans[10]; 5 bool vis[10]; 6 bool conect(int x,int y) 7 { 8 if (x>y) {int t=x; x=y; y=t;} 9 switch (x)10 {11 case 1:return y==2 || y==3 || y==4;12
阅读全文
posted @ 2012-01-13 21:40
Qiuqiqiu
阅读(225)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1035不知道为什么这也是搜索题,分明就是模拟题我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=15; 4 const int dx[4]={0,1,0,-1}; 5 const int dy[4]={1,0,-1,0}; 6 char maze[N][N]; 7 int n,m,cnt,x,y; 8 int vis[N][N]; 9 int main()10 {11 int d,i;12 while (scan
阅读全文
posted @ 2012-01-13 17:46
Qiuqiqiu
阅读(198)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1258dfsView Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 const int N=20; 5 int a[N],n,t,flag; 6 bool vis[N]; 7 void print() 8 { 9 flag=1;10 bool bol=0;11 int i;12 for (i=1;i<=n;i++) if (vis[i])13 {14 if...
阅读全文
posted @ 2012-01-13 16:17
Qiuqiqiu
阅读(193)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1518dfs+剪枝我的代码 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 const int N=25; 5 int a[N],ans,ave,n; 6 bool vis[N]; 7 int cmp(const void *a,const void *b) 8 { 9 return *(int*)b - *(int*)a;10 }11 void dfs(int s,int p,int k
阅读全文
posted @ 2012-01-13 15:44
Qiuqiqiu
阅读(480)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2952dfs我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=110; 4 const int dx[4]={1,0,-1,0}; 5 const int dy[4]={0,1,0,-1}; 6 char maze[N][N]; 7 bool vis[N][N]; 8 int n,m; 9 void dfs(int x,int y)10 {11 vis[x][y]=1;12 int d,nx,ny;13 for
阅读全文
posted @ 2012-01-13 13:32
Qiuqiqiu
阅读(217)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1312dfs我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=25; 4 const int dx[4]={1,0,-1,0}; 5 const int dy[4]={0,1,0,-1}; 6 char maze[N][N]; 7 bool vis[N][N]; 8 int m,n,cnt; 9 void dfs(int x,int y)10 {11 cnt++;12 vis[x][y]=1;13 int d,n
阅读全文
posted @ 2012-01-13 13:08
Qiuqiqiu
阅读(149)
推荐(0)
编辑