Prim
文章平均质量分 84
Lionel_D
这个作者很懒,什么都没留下…
展开
-
hdu 1162 Eddy's picture 最小生成树入门题 Prim+Kruskal两种算法AC
Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictures to let his friends appreciate. but the result it can原创 2015-02-22 13:24:38 · 884 阅读 · 0 评论 -
hdu 2489 Minimal Ratio Tree DFS枚举点+最小生成树 属于中等偏上题 ,Double比较大小的时候注意精度问题
Problem Description For a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation. Given a complete graph of n nodes with all nodes and edges weighted, your task is to find a tree, which is a sub原创 2015-02-23 23:01:50 · 862 阅读 · 0 评论 -
hdu 3371 Connect the Cities Prim + Kruskal两种算法分别AC 水过~~~~
Problem Description In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government wants to build some roads to connect all of these cities原创 2015-02-23 16:14:15 · 1023 阅读 · 0 评论 -
hdu 2682 Tree 最小生成树~~~~水题一枚,,用到了筛法求素数,我竟然在格式上面PE了两次!!
Problem Description There are N (2<=N<=600) cities,each has a value of happiness,we consider two cities A and B whose value of happiness are VA and VB,if VA is a prime number,or VB is a prime number or (VA+VB) is a prime number,then they can be connected.W原创 2015-02-24 21:23:48 · 1273 阅读 · 0 评论 -
hdu 1102 Constructing Roads 最小生成树Prim算法AC 水~~~
Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if there is a road between A and B, or t原创 2015-02-23 14:37:23 · 827 阅读 · 0 评论 -
hdu 4081 Qin Shi Huang's National Road System 次小生成树 算法
During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China ---- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the kingdom Qin. Through 9 years of wars, he finally conquered all six o原创 2015-02-22 21:43:05 · 953 阅读 · 0 评论 -
hdu 1863 畅通工程 最小生成树模板入门题 prim+kruskal两种算法AC。
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 );随后的 N 行对应村庄间道路的成本,每行给出一对正整数,分别是两个村庄的编号,以及此两村庄间道路的成本(也是正整原创 2015-02-22 12:12:00 · 958 阅读 · 0 评论 -
hdu 1879 继续畅通工程 最小生成树入门模板题
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1< N < 100 );随后的 N(N-1)/2 行对应村庄间道路的成本及修建状态,每行给4个正整数,分别是两个村庄的编号(从原创 2015-02-21 20:54:09 · 826 阅读 · 0 评论 -
hdu 1679 The Unique MST 次小生成树 简单题
Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties: 1原创 2015-02-23 12:35:15 · 1087 阅读 · 0 评论 -
hdu 4463 Outlets Prim 次小生成树 简单题
Problem Description In China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to think foreign things are better and we are willing to pay much for them. The typical example is, on the Uni原创 2015-02-23 11:39:26 · 914 阅读 · 0 评论 -
poj1258 Agri-Net 最小生成树水题
Agri-Net Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 55019 Accepted: 22821 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your原创 2017-01-09 15:34:02 · 604 阅读 · 0 评论