![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路
一步一步地往上爬
沉心静气,默默努力
展开
-
POJ 1724 ROADS
题目描述:找一条路径最短条件下的花费最少的路!!!看反了改了一下午!!! 稀疏图,用邻接表,否则超出内存限制 用优先队列储存到达每一个点的时候的状态,重载小于号修改排序规则,这样队首一定是当前条件下最优选择 又有点像bfs #include <stdlib.h> #include <stdio.h> #include <iostream> #i...原创 2019-08-19 10:19:45 · 112 阅读 · 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 t...原创 2019-08-14 10:56:33 · 69 阅读 · 0 评论 -
HDU 1874 畅通工程续
题目描述: 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input 本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(0<N<200...原创 2019-08-14 18:23:11 · 238 阅读 · 0 评论 -
POJ 3268 Silver Cow Party
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way ro...原创 2019-08-24 11:55:35 · 80 阅读 · 0 评论 -
POJ 2253 Frogger
题目描述: Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of touris...原创 2019-08-17 09:08:11 · 87 阅读 · 0 评论 -
POJ 1797 Heavy Transportation
题目描述: 在图中找一条最小权值最大的行遍所有点的路 思路分析: 每一步都走权值最大点,注意松弛操作 AC #include <stdlib.h> #include <stdio.h> #include <iostream> #include <queue> #include <stack> #inclu...原创 2019-08-17 10:43:00 · 103 阅读 · 0 评论 -
POJ 1860 Currency Exchange
题目描述: 给出一定数量的某种钱币,通过外汇一系列兑换增加钱币数量。 这个“外汇"很扯,A->B和B->A的汇率都能大于1 思路分析: 抽象成图,每种钱币是一个节点,兑换途径就是路径。显然增加钱币数量,图中必须要有一个汇率都大于1的回路,且该回路必须与最初货币连通。那么现在的任务就是,找到这个回路 此题是找正回路,和负回路略有不同但是思路是一样的 B-F算法可以找负回...原创 2019-09-08 09:52:58 · 114 阅读 · 0 评论