随笔分类 -  图论

上一页 1 2
hdu 1162(最小生成树kruskal)
摘要:/* Name: 最小生成树(kruskal) Author: Date: 10/04/12 19:17*/#include <math.h>#include <cstdio>#include <iostream>using namespace std;const int M = 5050;int p[101], sum;struct edge { int a; int b; double dis;}e[M];struct point { double x; double y;}po[101];int cmp(const void *a, const v.. 阅读全文
posted @ 2012-04-10 19:20 Try86 阅读(228) 评论(0) 推荐(0)
hdu 1875(最小生成树kruskal)
摘要:/* Name: 最小生成树(kruskal) Author: Try_86 Date: 10/04/12 18:51 Description: 不符合题意所述的距离不加进边集中,然后套用kruskal就可以了 */#include <cmath>#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int M = 5050;int p[M], sum;struct edge { int a; int b; double dis;}e[M]; 阅读全文
posted @ 2012-04-10 18:55 Try86 阅读(289) 评论(0) 推荐(0)
hdu 1863(最小生成树kruskal)
摘要:/* Name: hdu1863畅通工程 Author: Try86 Date: 10/04/12 12:43 Description: 最小生成树(kruskal) */#include <cstdio>#include <iostream>using namespace std;const int M = 5050;int p[M], sum; //sum统计顶点个数 struct edge { int a; int b; int w;}e[M];int cmp(const void *a, const void *b) { return (*(edge ... 阅读全文
posted @ 2012-04-10 12:47 Try86 阅读(910) 评论(0) 推荐(0)
hdu 1879(最小生成树kruskal)
摘要:/** 最小生成树,(kruskal) * 本题要点:当两点之间已有路时,把这两点的路长设为0,然后就是套用kruskal了 */#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;const int M = 5050;int p[M];struct edge {//边节点 int a; int b; int w;}e[M];int cmp(const void *a, const void *b) {//按权值从小到大排序 return (*(edge *)a) 阅读全文
posted @ 2012-04-09 22:57 Try86 阅读(569) 评论(0) 推荐(0)
hdu 1233(最小生成树kruskal)
摘要:/** 最小生成树练手题,采用kruskal求解 */#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>using namespace std;const int M = 5050;int p[M];struct edge {//边节点 int a; int b; int w;}e[M];int cmp(const void *a, const void *b) {//按权值从小到大排序 return (*(edge *)a).w - (*(edge * 阅读全文
posted @ 2012-04-09 22:15 Try86 阅读(198) 评论(0) 推荐(0)

上一页 1 2