上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 28 下一页
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1649//hnldyhy(303882171) 11:12:46// zoj 1649//bfs +优先队列#include #include #include using namespace std;struct node{ int x; int y; int step;};bool operatorb.step) return true; else return false;}char g[201][201];int main(){ ... 阅读全文
posted @ 2013-12-06 21:31 博园少主 阅读(224) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1586//zoj 1586#include#includeusing namespace std;#define N 1005int a[N][N],low[N],n,ans;int b[N];int min(int x,int y){ return x#includeusing namespace std;#define N 1005int a[N][N],low[N],n,ans;int b[N];int min(int x,int y){ return ... 阅读全文
posted @ 2013-12-06 21:16 博园少主 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1372#include#includeusing namespace std;#define N 1005int a[N][N],low[N],n,ans;int b[N];int min(int x,int y){ return xci) { a[ai-1][bi-1]=ci; a[bi-1][ai-1]=ci; } } ans=0; if(n!=1) prim(0); ... 阅读全文
posted @ 2013-12-06 21:13 博园少主 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #include // poj 1258 10.1.5.253 1505using namespace std; #define N 105 // 顶点的最大个数 (多写 int a[N][N],low[N],n,ans;int min(int x,int y){ return x>n&&n>=3) { for (i=0;i>a[i][j]; prim(0); // 从0开始 cout<<ans<<endl; } return 0;} 阅读全文
posted @ 2013-12-06 21:06 博园少主 阅读(284) 评论(0) 推荐(0) 编辑
摘要: http://10.1.5.253/acmhome/problemdetail.do?&method=showdetail&id=1502//1502#include #include #include using namespace std;#define N 10int g[N][N],bz[N],n,m,t;queue q;void BFS(int cur){ int j; bz[cur]=1; q.push(cur); while (!q.empty()) { cur=q.front(); printf("%d", cur);t++; if(t=.. 阅读全文
posted @ 2013-12-06 20:25 博园少主 阅读(306) 评论(0) 推荐(0) 编辑
摘要: memset(a,0,sizeof(a)) 0memset(a,-1,sizeof(a)) -1#include #include using namespace std;int main(){ int a[10]; memset(a,-1,sizeof(a));... 阅读全文
posted @ 2013-12-06 14:08 博园少主 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-12-06 14:02 博园少主 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 输入:8 91 21 32 42 53 63 74 85 86 7// 图的BFS,使用C++队列#include #include #include using namespace std;#define N 10int g[N][N],bz[N],n,m;queue q;void BFS(int cur){ int j; bz[cur]=1; q.push(cur); while (!q.empty()) { cur=q.front(); printf(" V%d ", cur);q.pop(); for (j=1;j#include #defi... 阅读全文
posted @ 2013-12-06 13:54 博园少主 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;#define N 20int a[N][N],m[N],bz[N],n,s;void dfs(int k){ int i; if ( s==n) { for (i=0; i>n>>t; for (i=1; i>x>>y; a[x][y]=a[y][x]=1; } bz[0]=1; m[0]=0; s=1; dfs(0) ; return 0;} **************************************************... 阅读全文
posted @ 2013-12-06 13:45 博园少主 阅读(230) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2110//2110#include#include#include#include#includeusing namespace std;int n, m, t, di, dj, flag;char map[10][10];int dir[4][2]={{0, 1}, {1, 0}, {0, -1}, {-1, 0}};void dfs(int si, int sj, int cnt){ int i, xx, yy; if(sin||sj>m) return ... 阅读全文
posted @ 2013-12-06 13:40 博园少主 阅读(168) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 28 下一页