最短路
文章平均质量分 83
dd
浪流人
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Wormholes POJ - 3259 spfa判断负环
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole! Each of FJ’s farms co原创 2021-04-29 20:06:22 · 209 阅读 · 0 评论 -
10072. 「一本通 3.2 例 1」Sightseeing Trip
题意:给你一个n个点加权无向图,要你从里面找一个路径最短的环,每个点只能经过一次 ,如果存在这样的最短环则把路径给打印出来,如果有多个,打印一个出来即可。本题的重点是,如果用简单的用floyd求最小环,你会发现在求最短路的过程中有很多点是重复经过的。现在的问题是怎么找没有重复经过同一个点的最小环,每次修改最小环是都记录下当前的path我们可以做一个限制 就是k比i,j都大,假如说求u->i->j->k->v的,最小环,如果u k v都确定的情况下,只需要找通过i j的最小路程,原创 2020-12-01 20:16:10 · 596 阅读 · 0 评论 -
第二周下 最短路
E题 Candies POJ - 3159n个人,m条规则b比a多c个糖,问n比1多几个不知道为什么队列过不去,#include<stdio.h>#include<string.h>#include<queue>#include<stack>#include<algorithm>using namespace std;#define N 30005int dis[N],book[N],cnt,m,n;int head[原创 2020-09-27 19:23:20 · 143 阅读 · 0 评论 -
Roadblocks POJ - 3255 SPFA
Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along the way. She has decided to take the second-shortest rather than the原创 2020-05-12 19:23:50 · 197 阅读 · 0 评论 -
六度分离 HDO 1869 Floyd
Description1967年,美国著名的社会学家斯坦利・米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of separation)。虽然米尔格兰姆的理论屡屡应验,一直也有很多社会学家对其兴趣浓...原创 2020-04-05 16:22:59 · 241 阅读 · 0 评论 -
POJ1797---Heavy Transportation(最短路变形)
原题链接求一条能运多重货物路上的最小值代码#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int map[1002][1002],dis[1002],way[1002];int n,inf=99999999999;void dijkstra()...原创 2020-03-15 17:04:53 · 138 阅读 · 0 评论 -
Silver Cow Party(dijkstra)
原题链接原题做的第一道最短路 明显比模板题要难一点点。。。。。求牛来回的最短路中的最长时间 路是单向的,所以你可以用一个way数组记录一下来时的时间返回的时候你如果求各个农场到目标农场的最短路就太耗时了 所以你可以反转一下来和去的路下面是代码#include<stdio.h>#include<string.h>#include<algorithm&...原创 2020-03-14 10:34:17 · 158 阅读 · 0 评论 -
Hdu--Arbitrage(Floyd)
floyd 变形 输的时候费老半天气 还是太菜。。代码#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;double map[50][50];int n,inf=9999999,flag;void floyd(){ int i,j,k;...原创 2020-03-14 10:23:57 · 155 阅读 · 0 评论
分享