随笔分类 -  最小生成树

 
HDU 1863
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863复习考研练练写Prim,第一次写,乱搞的,有点难看邻接表+堆#include #include #include #include using namespace std;int n, m, cnt, ct,... 阅读全文
posted @ 2015-12-21 18:49 LegendaryAC 阅读(182) 评论(0) 推荐(0)
HDU 1102 Constructing Roads
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1102最简单的最小生成树View Code #include #include #include int p[110];int cnt,n; typedef struct L{ int a,b,d; }L... 阅读全文
posted @ 2012-05-08 11:34 LegendaryAC 阅读(197) 评论(0) 推荐(0)
HDU 1162 Eddy's picture
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1162最简单的最小生成树。。。View Code #include #include #include int p[110];int cnt,n; typedef struct L{ int a,b; ... 阅读全文
posted @ 2012-05-07 23:37 LegendaryAC 阅读(189) 评论(0) 推荐(0)
HDU 1301 Jungle Roads
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1301最简单的最小生成树View Code #include #include int p[30];int cnt,n; typedef struct L{ int a,b,d;}L;L r[1000]; ... 阅读全文
posted @ 2012-05-07 22:43 LegendaryAC 阅读(186) 评论(0) 推荐(0)
HDU 1879 继续畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1879最小生成树。。。m,n又看反了。。。无语ingView Code #include #include #include int idx[1000000];struct node{ int a,b,cos... 阅读全文
posted @ 2012-04-13 13:09 LegendaryAC 阅读(145) 评论(0) 推荐(0)
HDU 1863 畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863裸的最小生成树,只需多判断一下是否连通,我用的方法是看是否只有一个根节点。ps:m和n写反了,害我查了1h啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊View Code #include #include #include... 阅读全文
posted @ 2012-04-13 10:12 LegendaryAC 阅读(208) 评论(0) 推荐(0)
HDU 1233 还是畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1233最小生成树,查找根节点的函数里面等号写成赋值号,查了半个小时、、、View Code #include #include #define N 110int idx[N];struct node{ int... 阅读全文
posted @ 2012-04-13 09:06 LegendaryAC 阅读(145) 评论(0) 推荐(0)