题目链接:
题目链接:1050: [HAOI2006]旅行comf求起点到终点的一条路径,使得路径最长边与最短边比值最小。 边按小到大排序。枚举最小边值依次加边,直至起点终点联通,更新答案。代码:#include <iostream>#include <algorithm>#include <set>#include <map>#include <str
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1212 水题。代码:#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include &
题目链接: https://uva.onlinejudge.org/index.php?option码:略
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1029根据给出的条件,求最大和最小生成树的平均值。代码:#include <iostream>
题目链接:http://poj.org/problem?id=1251简单题#include <stdio.h>#include <iostream>#include <string.h>#include <algorithm>#include <math.h>#include <stack>#include <
次小生成树模板通过poj 1679#include <stdio.h>#include <iostream>#include <string.h>#include <algorithm>#include <math.h>#include <stack>#include <queue>#include <set
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. Definitio
题目连接: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
题目链接:点击链接 题意:求生成树,使得最大边与最小边差最小,输出最小值; 枚举边更新答案。#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include <math.h> #include <stack> #include <queue> using na
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
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1380最小树形图也就是有向图的最小生成树。普通的prim无法求解。#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <string>#include <qu
简单题.NetworkingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6448 Accepted: 3500DescriptionYou are assigned to design network connections b
http://poj.org/problem?id=1258简单题#include #include #include #include #include #define INF 10099990using namespace std;int map[110][110],dis[110],v[110];long long prim(int n){ int
http://poj.org/problem?id=1679The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21550 Accepted: 7619DescriptionGiven a connected
通过:poj-1287#include #include #include #include #include #include #include using namespace std;#define INF 10000000int n, m;int a, b, c;int map[100][100], dis[100], v[100];int prim(in
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1102Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14983 Accepted
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1586简单题Sunny Cup 2003 - Preliminary RoundApril 20th, 12:00 - 17:00Problem E: QS NetworkIn the planet w-503 of galaxy cgb, t
题目链接:点击打开链接又是一发 G++ WA , C++ AC.简单题:给出基站的三围坐标及半径 。若球面距离小于 0 距离为 0 ,否则为 圆心距离减去2个半径#include #include #include #include #include #define INF 10000000using namespace std;double map[110]
http://poj.org/problem?id=1789题意理解就是裸的MST#include#include#include#define INF 0x3f3f3f3fusing namespace std;char str[2010][10];int dis[2010],edge[2010][2010];bool vis[2010];int m,ans;in
http://poj.org/problem?id=1751最小生成树简单应用#include #include #include #include #include #include #include using namespace std;#define INF 10000000double map[1110][1110],dis[1110];int n,m,v
模板题#include#define INF 999999using 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)
最小生成树//prim 求最小生成树#include #include #include #define MAXN 105#define UPPERDIS 999999double lowcost[MAXN],vist[MAXN];double cost[MAXN][MAXN];int n;double prim(int v0){ int i, j, minone;
求最小生成树的最大边 ,
最小生成树 注意浮点型 :
睡不着了 起来A一题 最小
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号