最小生成树
最小生成树
dreambyday
我大抵是病了,
横竖都写不出一行代码。
站起身来点起了一支烟,
这悲伤没有由来。
默默然跑到楼下买了根82年老冰棍,
一口是我吃的,
另一口也是我吃的,
大抵又是到了摸鱼的时刻了吧。
展开
-
POJ 1789 Truck History
Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a tru原创 2017-02-05 12:34:42 · 537 阅读 · 0 评论 -
POJ - 3026Borg Maze
我好像是理解错题意了。。。现在我想的是当人们找到达到一个目的点后才可以分成多批人。 看了网上的一些代码,但貌似都没有解决一种情况,测试数据貌似也没有这种情况。。。 空空A空空 在第一行时用gets,调试时发现这一行的A在第一个位置,这一行的长度为3,也就是A前面的两个空没有被储存在数组中。 先这样吧。 用bfs求出任意两点的距离,之后裸的prim#include<iostream> #inc原创 2017-09-08 21:00:52 · 206 阅读 · 0 评论 -
POJ - 2031 Building a Space Station prim
n是球数量,每行四个数代表坐标xyz和球半径。球之间建边,球之间相接触就不需要建边,求建边最小和。#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #i原创 2017-09-06 20:46:31 · 301 阅读 · 0 评论 -
POJ - 1251Jungle Roads prim()
只想静静的水题。prim#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #include <stdlib.h> using namespace std原创 2017-09-06 18:57:25 · 198 阅读 · 0 评论 -
POJ - 1258Agri-Net
#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #include <stdlib.h> using namespace std; #define IN原创 2017-09-06 13:15:44 · 184 阅读 · 0 评论 -
POJ - 2421Constructing Roads prim
已连接的两条边权值更新为0,直接prim就可以了。#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #include <stdlib.h> using原创 2017-09-06 13:09:08 · 170 阅读 · 0 评论 -
POJ - 2349Arctic Network最小生成树kruskal
贴模板 有卫星的两个点之间随意通信。没有卫星的点之间距离不超过D可以通信。求最小D。 没有卫星的情况下,用kruskal建一课最小生成树时,会对边进行排序。这时边的最大值就是答案。有卫星的情况下,让距离最大的点拥有卫星,s个卫星使用了s-1个边。第 总边数减去s-1 个边就是要求的最小D。#include <stdio.h> #include <string.h> #include <iostr原创 2017-09-05 22:46:48 · 308 阅读 · 0 评论 -
ZOJ - 1586QS Network prim
建图边值为电缆得钱数加上两边电话的钱数,贴模板#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #include <stdlib.h> using na原创 2017-09-05 21:34:07 · 184 阅读 · 0 评论 -
POJ - 1751Highways最小生成树kruskal
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already constructed a numbe原创 2017-09-05 09:28:43 · 252 阅读 · 0 评论 -
POJ - 1287Networking
虽说是复习,但还是要贴上,文章+1#include <stdio.h> #include <string.h> #include <iostream> #include<algorithm> #include <vector> #include <queue> #include <string> #include <math.h> #include <stdlib.h> using namespac原创 2017-09-04 19:12:48 · 198 阅读 · 0 评论 -
HDU - 1875畅通工程再续
#include<iostream> #include<cstring> #include<math.h> #include<algorithm> #include<queue> #include<stdio.h> using namespace std; #define mem(arr,a) memset(arr,a,sizeof(arr)) #define V 1000+4 #define sc原创 2017-09-08 22:27:29 · 255 阅读 · 0 评论