最短路
文章平均质量分 84
Top_Spirit
我的指针已经找了他的对象,而我呢?
展开
-
HDU 1874 (最短路 ---Bellman_Ford)
最短路之Bellman_Ford:使用Bellman-Ford算法的一般步骤如下: 1. 初始化所有d[i]为INF,d[start] = 0 2. 进行循环,遍历所有的边进行松弛计算 3. 进行完步骤2中的循环之后,在进行一次循环判断是否讯在负权值边,如果满足d[u]>d[v]+w(u,v)就代表存在负权值边.(这个可以解决权值为负值的最短路,弥补了Dijlstra的短板)要是比较的一个算...原创 2018-03-07 13:12:35 · 174 阅读 · 0 评论 -
Part Acquisition POJ - 2457 (Spfa+优先队列优化+输出路径)
The cows have been sent on a mission through space to acquire a new milking machine for their barn. They are flying through a cluster of stars containing N (1 <= N <= 50,000) planets, each with...原创 2019-05-13 21:22:49 · 222 阅读 · 0 评论 -
Newcoder Ramen Network Protocol (多源最短路)
链接:https://ac.nowcoder.com/acm/contest/624/D来源:牛客网You should have been heard of TCP and UDP. They are the most popular network protocols currently.Recently, noodles, or more specifically, R...原创 2019-04-23 20:10:48 · 159 阅读 · 0 评论 -
Newcoder New Game! (最短路)
题目描述Eagle Jump公司正在开发一款新的游戏。Hifumi Takimoto作为其中的员工,获得了提前试玩的机会。现在她正在试图通过一个迷宫。这个迷宫有一些特点。为了方便描述,我们对这个迷宫建立平面直角坐标系。迷宫中有两条平行直线 L1:Ax+By+C1=0, L2:Ax+By+C2=0,还有 n 个圆Ci:(x−xi)2+(y−yi)2=ri2Ci:(x−xi)2+(y−yi...原创 2019-05-02 10:54:31 · 147 阅读 · 0 评论 -
Bus Pass HDU - 2377(最短路)
You travel a lot by bus and the costs of all the seperate tickets are starting to add up.Therefore you want to see if it might be advantageous for you to buy a bus pass.The way the bus system wor...原创 2019-05-02 10:04:27 · 324 阅读 · 0 评论 -
Codeforces Edge Deletion 最短路+bfs
D. Edge Deletiontime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirected connected weighted graph consisti...原创 2018-11-14 19:07:41 · 162 阅读 · 0 评论 -
次短路
How Many Paths Are ThereTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1925 Accepted Submission(s): 682 Problem Description oooccc1 ...原创 2018-10-04 15:37:06 · 113 阅读 · 0 评论 -
最短路Floyd及输出路径 HDU 1385
Problem DescriptionThese 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...原创 2018-09-24 09:09:28 · 818 阅读 · 0 评论 -
最短路+背包 HDU 3339
Problem DescriptionSince 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the globe.Nowadays,the crazy boy i...原创 2018-09-24 09:03:01 · 225 阅读 · 0 评论 -
最短路例题 HDU 2544
题目连接:点击打开链接Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个...原创 2018-05-02 19:40:38 · 147 阅读 · 0 评论 -
最短路 (floyd)算法
最短路算法之一:floyd算法模版:时间复杂度O(n^3)。题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1874 (水题)Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让...原创 2018-03-04 20:14:13 · 212 阅读 · 0 评论 -
poj 2387 最短路Dijkstra
简单的水题,之前做过的,只不过那个时候很懵懂。哈哈哈所以一直写不出来,我也是非常的菜的,现在也一样。。题目链接 :点击打开链接DescriptionBessie 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...原创 2018-03-10 12:44:03 · 151 阅读 · 0 评论 -
HDU 1874 最短路 Spfa
不用多说了,还跟前几个算法一样是相同的题,因为是刚学最短路,就用这道极简单的模版题熟悉一下这四种算法的嘛,哈哈哈。。 这次的是学的最后一种的关于最短路的算法了,Spfa算法: 用队列模拟,取出队首元素,每次找到与队首相邻的点,看是否发生可以松弛,从而更新dis数组,如果相邻的某些点已经在队列中了就不需要入队了,没在队列的点(与取出的队首相邻的点)使其入队,然后再找,再入队.....原创 2018-03-07 16:16:12 · 189 阅读 · 0 评论 -
Choose the best route HDU - 2680 (多源点最短路)
ne day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as soon as possible . Now give you a map of the city’s traffic route, and t...原创 2019-05-09 19:15:37 · 188 阅读 · 0 评论