
最短路径
风之旅@
努力到一定的程度,幸运就会与你不期而遇
展开
-
HDU - 1875 畅通工程再续
相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个...原创 2019-03-20 21:32:26 · 146 阅读 · 0 评论 -
POJ - 2387 Til the Cows Come Home (链式前向星+优先队列)
Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get ...原创 2019-03-17 14:48:52 · 256 阅读 · 0 评论 -
POJ - 3268 Silver Cow Party
One cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirectional (one-way r...原创 2019-03-21 21:05:04 · 201 阅读 · 0 评论 -
HDU - 1874 畅通工程续 (链式前向星+优先队列+dijkstra)
某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<20...原创 2019-03-19 11:49:46 · 155 阅读 · 0 评论 -
POJ - 3660 Cow Contest
N(1 ≤N≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is u...原创 2019-03-29 20:36:07 · 93 阅读 · 0 评论 -
HDU - 1385 Minimum Transport Cost (floyd)
These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transpo...原创 2019-04-17 22:11:39 · 164 阅读 · 0 评论 -
POJ - 3169 Layout (SPFA)
Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are ...原创 2019-04-22 21:49:59 · 121 阅读 · 0 评论