
最短路
文章平均质量分 69
cloudy_happy
像我这样优秀的人,不该平凡过一生
展开
-
HDU1874 畅通工程续 最短路Dijkstra算法
畅通工程续 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input 本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(0<N&l...原创 2018-08-14 15:51:11 · 171 阅读 · 0 评论 -
poj2387 Til the Cows Come Home 最短路dijkstra
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 s...原创 2018-08-14 22:50:53 · 129 阅读 · 0 评论 -
Lightoj1019 Brush (V) Dijkstra最短路
Brush (V) Tanvir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming contest? After checking a bit he found t...原创 2018-08-14 22:54:02 · 164 阅读 · 0 评论 -
poj3268 Silver Cow Party Dijkstra最短路
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) unid...原创 2018-08-14 23:07:56 · 132 阅读 · 0 评论 -
51nod1459 迷宫游戏 Dijkstra最短路
迷宫游戏 你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快离开迷宫...原创 2018-08-15 00:14:54 · 201 阅读 · 0 评论 -
2019icpc南京网赛H
题意: 给定一个n个点m条边的有向含负权值边并且无自环图,构造6条给定边求这六条边的权值最小使得加上每条边后图中不含负环。ps:后面的边不影响前面的,每条构造好的边要加入图中 思路: 数据范围较小,直接暴力跑6次spfa即可 #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 0x3...原创 2019-09-05 18:44:37 · 223 阅读 · 0 评论