随笔分类 -  ACM之路---最小生成树

摘要:#include#includeusing namespace std;int f[1001], sum, m, n;struct node{ int x, y, w;}p[1001];bool cmp(const node &a, const node &b){ return a.w>n>>m, n) { for(int i=1; i>p[i].x>>p[i].y>>p[i].w; } kruskal(); } return 0;} 阅读全文
posted @ 2014-03-12 20:13 xtaq 阅读(133) 评论(0) 推荐(0)
摘要:裸的最小生成树。。如果对最小生成树的算法还不是太熟的话。。推荐看看这个博客。。个人认为讲解的不错。http://blog.csdn.net/fengchaokobe/article/details/7521780题没什么好说了。。最小生成求最小权值。。代码:#include#includeusing namespace std;int map[110][110], low[110], n;int prim(){ int sum=0, m=1, s=1, mark, minn, i; bool u[110]={0}; u[s]=1; for(i=1; imap[s][i]... 阅读全文
posted @ 2014-03-01 20:05 xtaq 阅读(174) 评论(0) 推荐(0)