
----------生成树
mfcheer
他不停地跑啊跑 就为了追上那个曾经被寄予厚望的自己
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj-2395
求最小生成树的最大边 ,原创 2014-10-27 21:49:40 · 508 阅读 · 0 评论 -
hdu 1102 & poj 2421 Constructing Roads
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1102 Constructing Roads Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14983 Accepted原创 2015-01-25 17:35:42 · 589 阅读 · 0 评论 -
uva 1395 Silm Span 【MST-Kruskal】
题目链接:点击链接 题意:求生成树,使得最大边与最小边差最小,输出最小值; 枚举边更新答案。#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include <math.h> #include <stack> #include <queue> using na原创 2015-03-29 21:20:07 · 499 阅读 · 0 评论 -
kruskal 【MST】
const int MAXN = 110;//点 const int MAXM = 10000;//边int f[MAXN];//并查集使用struct Edge { int u, v, w; }edge[MAXN];int tol;//边数 初始化 0void addedge(int u,int v,int w) { edge[tol].u = u; edge[tol].v原创 2015-03-29 20:20:09 · 619 阅读 · 0 评论 -
LightOJ 1040 – Donation 【Prim】
题目连接:http://www.lightoj.com/volume_showproblem.php?problem=1040题意也不说了。水题#include <stdio.h> #include <iostream> #include <string.h> #include <string> #include <algorithm> #include <math.h> #include <cty原创 2015-06-05 18:18:56 · 779 阅读 · 0 评论 -
POJ 1679 THE UNIQUE MST 【次小生成树】
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22098 Accepted: 7847 DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.原创 2015-06-05 23:47:58 · 435 阅读 · 0 评论 -
LIGHTOJ 1029 – CIVIL AND EVIL ENGINEER 【PRIM】
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1029根据给出的条件,求最大和最小生成树的平均值。代码:#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <queue>u原创 2015-06-05 23:22:25 · 506 阅读 · 0 评论 -
UVA 10457 - Magic Car【最小瓶颈树】
题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=600&problem=1398&mosmsg=Submission+received+with+ID+14106648题意: m条路,每条路上必须维持速度v,现在有一辆车,启动能量和结束能量原创 2015-08-10 21:04:54 · 730 阅读 · 0 评论 -
UVA 10034 Freckles 【最小生成树】
题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975题意:裸的最小生成树代码:#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #i原创 2015-08-12 11:08:25 · 802 阅读 · 0 评论 -
UVA 10369 Arctic Network【最小生成树】
题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1310题意: 有m个卫星,n个站点,卫星可以不用代价相连,剩下要用无线电连,求无线电连接中最大距离的最小解法: 最小边开始加入,这样第n - m 条边的权值就是答案代码:略原创 2015-08-14 00:46:52 · 890 阅读 · 0 评论 -
UVA 534 Frogger 【最小瓶颈树】
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=475题意:求点1到2所有路径上最大边的最小值。解法:Kruskal按边值排序。直到1,2联通。代码:#include <stdio.h> #include <iostream> #include <algor原创 2015-08-08 18:49:04 · 1207 阅读 · 0 评论 -
51nod 1212 无向图最小生成树
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1212水题。代码:#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include <math.h> #include <stack>原创 2015-10-03 01:52:24 · 364 阅读 · 0 评论 -
BZOJ 1050: [HAOI2006]旅行comf
题目链接:1050: [HAOI2006]旅行comf求起点到终点的一条路径,使得路径最长边与最短边比值最小。 边按小到大排序。枚举最小边值依次加边,直至起点终点联通,更新答案。代码:#include <iostream> #include <algorithm> #include <set> #include <map> #include <string.h> #include <queue>原创 2015-10-08 19:26:57 · 113 阅读 · 0 评论 -
poj-1251 Jungle Roads
题目链接:http://poj.org/problem?id=1251 简单题 #include #include #include #include #include #include #include using namespace std; #define INF 10000000 int n, m; char a[5], b[5]; int c, d; int ma原创 2015-01-25 14:32:23 · 780 阅读 · 0 评论 -
图论——次小生成树
次小生成树模板 通过poj 1679 #include #include #include #include #include #include #include #include using namespace std; #define INF 10000000 /* * 次小生成树 * 求最小生成树时,用数组Max[i][j]来表示MST中i到j最大边权原创 2015-01-27 13:34:41 · 742 阅读 · 0 评论 -
poj-2377
睡不着了 起来A一题 最小原创 2014-10-20 02:00:49 · 504 阅读 · 0 评论 -
hdu-1875
最小生成树 注意浮点型 :原创 2014-10-20 23:55:10 · 575 阅读 · 0 评论 -
hdu-1301
模板题 #include #define INF 999999 using namespace std; int map[30][30],dis[30],v[30]; int prim(int n) { int i,j,k,min,sum=0; for(i=1;i<=n;i++) dis[i]=map[1][i]; memset(v,0,sizeof(v)原创 2014-11-24 20:43:57 · 551 阅读 · 0 评论 -
hdu-1162
最小生成树 //prim 求最小生成树 #include #include #include #define MAXN 105 #define UPPERDIS 999999 double lowcost[MAXN],vist[MAXN]; double cost[MAXN][MAXN]; int n; double prim(int v0) { int i, j, minone;原创 2014-11-24 21:08:08 · 608 阅读 · 0 评论 -
poj-1287 最小生成树
简单题. Networking Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6448 Accepted: 3500 Description You are assigned to design network connections b原创 2015-01-25 13:26:18 · 902 阅读 · 0 评论 -
zoj -1586 QS Network
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1586 简单题 Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-503 of galaxy cgb, t原创 2015-01-27 15:05:33 · 595 阅读 · 0 评论 -
poj-1751 Highways
http://poj.org/problem?id=1751 最小生成树简单应用 #include #include #include #include #include #include #include using namespace std; #define INF 10000000 double map[1110][1110],dis[1110]; int n,m,v原创 2015-01-27 16:50:45 · 698 阅读 · 0 评论 -
poj-1679 The Unique MST
http://poj.org/problem?id=1679 The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21550 Accepted: 7619 Description Given a connected原创 2015-01-27 13:36:37 · 826 阅读 · 0 评论 -
poj-1258 Agri-Net
http://poj.org/problem?id=1258 简单题 #include #include #include #include #include #define INF 10099990 using namespace std; int map[110][110],dis[110],v[110]; long long prim(int n) { int原创 2015-01-27 14:04:36 · 590 阅读 · 0 评论 -
poj-2031 Building a Space Statio
题目链接:点击打开链接 又是一发 G++ WA , C++ AC. 简单题:给出基站的三围坐标及半径 。若球面距离小于 0 距离为 0 ,否则为 圆心距离减去2个半径 #include #include #include #include #include #define INF 10000000 using namespace std; double map[110]原创 2015-01-27 14:53:44 · 622 阅读 · 0 评论 -
poj-1789 Truck History
http://poj.org/problem?id=1789 题意理解就是裸的MST #include #include #include #define INF 0x3f3f3f3f using namespace std; char str[2010][10]; int dis[2010],edge[2010][2010]; bool vis[2010]; int m,ans; in原创 2015-01-27 19:48:59 · 527 阅读 · 0 评论 -
图论——最小生成树
通过:poj-1287 #include #include #include #include #include #include #include using namespace std; #define INF 10000000 int n, m; int a, b, c; int map[100][100], dis[100], v[100]; int prim(in原创 2015-01-25 13:34:49 · 747 阅读 · 0 评论 -
LightOJ 1380 – Teleport 【最小树形图】
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1380最小树形图也就是有向图的最小生成树。普通的prim无法求解。#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <qu原创 2015-04-14 19:42:55 · 755 阅读 · 0 评论