摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1241DFS我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=110; 4 const int dx[8]={0,1,1,1,0,-1,-1,-1}; 5 const int dy[8]={1,1,0,-1,-1,-1,0,1}; 6 char maze[N][N]; 7 int n,m,vis[N][N]; 8 void dfs(int x,int y) 9 {10 int d,nx,ny;11 vis[x][
阅读全文
posted @ 2012-01-14 18:47
Qiuqiqiu
阅读(256)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1548我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 const int N=210; 6 int n,k[N],vis[N],dis[N]; 7 queue<int> q; 8 int bfs(int s,int e) 9 {10 if (s==e) return 0;11 while (!q.empty()) q.pop();1
阅读全文
posted @ 2012-01-14 17:53
Qiuqiqiu
阅读(141)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2660没用搜索,DP,二维背包我的代码 1 #include <stdio.h> 2 const int INF=10000000; 3 int f[25][1010]; 4 int a[25],b[25]; 5 int main() 6 { 7 int T; 8 scanf("%d",&T); 9 int n,k,w,i,j,j1,j2;10 while (T--)11 {12 scanf("%d%d",&n,&k);13 for
阅读全文
posted @ 2012-01-14 17:31
Qiuqiqiu
阅读(180)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3368模拟我的代码 1 #include <stdio.h> 2 const int dx[8]={0,1,1,1,0,-1,-1,-1}; 3 const int dy[8]={1,1,0,-1,-1,-1,0,1}; 4 char maze[10][10]; 5 int f(int xx,int yy) 6 { 7 int d,cnt=0; 8 for (d=0;d<8;d++) 9 {10 int c=0,x=xx,y=yy;11 do{12 ...
阅读全文
posted @ 2012-01-14 17:10
Qiuqiqiu
阅读(195)
推荐(0)
编辑
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2209BFS我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 const int maxa=1100000; 6 char s[25]; 7 int a,vis[maxa],dis[maxa],l; 8 queue<int> q; 9 int bfs(int x)10 {11 if (x==0) return 0;12 while (
阅读全文
posted @ 2012-01-14 16:02
Qiuqiqiu
阅读(891)
推荐(0)
编辑