![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路
TheWise_lzy
已毕业,社畜一枚
展开
-
TOJ 3692:紧急援救 最短路 dijstra
描述 人质被恐怖分子扣押,幸好警察已经在一些路口准备好警车随时出动,救援马上开始...zzzz,稍安勿躁,警察需要以最少的时间到达案发现场,那应该出动哪辆警车呢?这辆警车最快需要多少时间能够到达现场呢?又幸好警方最近聘请了一位编程高手,那就是你,现在请你马上编写程序来实现。 输入 输入数据的第一行为3个整数n(n<=1000)、m(m<=10000)和s,其中...原创 2018-04-16 18:15:02 · 386 阅读 · 0 评论 -
7-9 旅游规划 (25 分) 最短路
7-9旅游规划(25分)有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是...原创 2019-03-27 21:28:57 · 850 阅读 · 0 评论 -
1072 Gas Station (30 分) dijstra最短路
A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hou...原创 2019-08-10 22:48:23 · 159 阅读 · 0 评论 -
1111 Online Map (30 分) dijstra最短路+dfs回溯路径
Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is g...原创 2019-08-10 20:54:04 · 252 阅读 · 0 评论 -
1087 All Roads Lead to Rome (30 分) dijstra+dfs 输出最短路路径+条数
1087All Roads Lead to Rome(30分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most hap...原创 2019-08-09 22:23:30 · 233 阅读 · 0 评论 -
1030 Travel Plan (30 分) dijstra最短路+dfs回溯路径
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b...原创 2019-08-09 21:20:12 · 258 阅读 · 0 评论 -
1018 Public Bike Management (30 分) dijstra+dfs 输出最短路路径
1018Public Bike Management(30分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...原创 2019-08-08 22:37:45 · 193 阅读 · 0 评论 -
1003 Emergency (25 分) dijstra输出最短路径条数 / floyd+dfs
1003Emergency(25分)As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue te...原创 2019-08-08 21:12:45 · 169 阅读 · 0 评论 -
HDU 2544 最短路 Dijkstra
滴,集训第二十四天打卡。今天是图论基础,除了并查集是之前在TOJ做过的,其他对我而言都是新题目呀...这里放一题最短路,等会转一篇大佬的各种最短路模板。 HDU 2544 最短路代码用的是最普通的Dijkstra算法。 #include<stdio.h>#include<string.h>const int N=105, INF=999...原创 2017-08-10 13:56:19 · 426 阅读 · 0 评论 -
POJ 2253 Frogger floyd变形
滴,集训第二十五天打卡。最近又好热好热了呀... 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, b...原创 2017-08-11 15:03:10 · 389 阅读 · 0 评论 -
L2-001. 紧急救援
L2-001. 紧急救援时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领...原创 2018-02-25 16:12:31 · 231 阅读 · 0 评论 -
天梯赛训练 哈利·波特的考试(25 分)
7-3 哈利·波特的考试(25 分)哈利·波特要考试了,他需要你的帮助。这门课学的是用魔咒将一种动物变成另一种动物的本事。例如将猫变成老鼠的魔咒是haha,将老鼠变成鱼的魔咒是hehe等等。反方向变化的魔咒就是简单地将原来的魔咒倒过来念,例如ahah可以将老鼠变成猫。另外,如果想把猫变成鱼,可以通过念一个直接魔咒lalala,也可以将猫变老鼠、老鼠变鱼的魔咒连起来念:hahahehe。现在...原创 2018-03-11 15:49:12 · 284 阅读 · 0 评论 -
TOJ1837 Minimum Transport Cost floyd
1837: Minimum Transport Cost描述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...原创 2018-07-24 19:54:13 · 185 阅读 · 0 评论 -
TOJ 1745 Arbitrage floyd
1745: Arbitrage 描述Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US ...原创 2018-07-28 14:44:40 · 196 阅读 · 0 评论 -
TOJ 5098 Sweet Butter Spfa
5098: Sweet Butter描述Farmer John has discovered the secret to making the sweetest butter in all of Wisconsin: sugar. By placing a sugar cube out in the pastures, he knows the N (1 <= N <= 500...原创 2018-07-30 20:36:56 · 191 阅读 · 0 评论 -
TOJ 1538 A Walk Through the Forest Spfa+DFS
1538: A Walk Through the Forest描述Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To ma...原创 2018-07-30 21:01:14 · 178 阅读 · 0 评论 -
TOJ 3744: Transportation Costs 最短路 Spfa
题目链接:http://210.32.82.1/acmhome/problemdetail.do?&method=showdetail&id=3744这道题对我而言有点难度...一开始想不好怎么去判断....然后发现可以找到从起点/终点出发到每个点的最短路,这样遍历之后,就可以空缺一条边作为“免费”的,然后得到最小值就可以了。#include <iostream&g...原创 2018-04-20 20:32:54 · 200 阅读 · 0 评论 -
L3-011 直捣黄龙 (30 分) 最短路 dijkstra
L3-011直捣黄龙(30分)本题是一部战争大片 —— 你需要从己方大本营出发,一路攻城略地杀到敌方大本营。首先时间就是生命,所以你必须选择合适的路径,以最快的速度占领敌方大本营。当这样的路径不唯一时,要求选择可以沿途解放最多城镇的路径。若这样的路径也不唯一,则选择可以有效杀伤最多敌军的路径。输入格式:输入第一行给出 2 个正整数 N(2≤N≤200,城镇总数)和 K(城...原创 2019-03-25 21:45:59 · 415 阅读 · 0 评论