最短路
titi2018815
菜鸟正在一步步成长!
展开
-
最短路径算法详解
前言:最短路径算法:用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。例子:暑期,你想要出门去旅游,但是在你出发之前,你想知道任意两个城市之间的最短距离。给出地图: 给出数据:4 81 2 21 3 61 4 42 3 33 1 73 ...原创 2019-09-09 21:03:45 · 2913 阅读 · 0 评论 -
Silver Cow Party POJ - 3268
题目:One cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirectional (one-wa...原创 2019-10-13 09:42:08 · 102 阅读 · 0 评论 -
Six Degrees of Cowvin Bacon POJ - 2139
题目:The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon".The game works like this: each cow is considered to be zero degrees ...原创 2019-10-13 08:59:25 · 160 阅读 · 0 评论 -
A - 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 one city to another. The tra...原创 2018-08-16 09:14:35 · 107 阅读 · 0 评论 -
C - 最短路径问题
题目:给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。(1<n<=1000, 0&...原创 2018-08-14 19:02:37 · 1966 阅读 · 0 评论 -
I - Wormholes
题目: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 t...原创 2018-08-14 11:16:50 · 182 阅读 · 0 评论 -
G - Stockbroker Grapevine
题目:Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the st...原创 2018-10-04 10:59:41 · 202 阅读 · 0 评论 -
F - 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 tourists...原创 2018-10-04 11:07:43 · 279 阅读 · 0 评论 -
算法训练 安慰奶牛
题目:Farmer John变得非常懒,他不想再继续维护供奶牛之间供通行的道路。道路被用来连接N个牧场,牧场被连续地编号为1到N。每一个牧场都是一个奶牛的家。FJ计划除去P条道路中尽可能多的道路,但是还要保持牧场之间 的连通性。你首先要决定那些道路是需要保留的N-1条道路。第j条双向道路连接了牧场Sj和Ej(1 <= Sj<= N; 1 <= Ej<= N; Sj...原创 2019-03-13 15:36:53 · 461 阅读 · 0 评论 -
Convenient Location Aizu - 0189
题目:便利な町来春卒業するAさんは、就職を機に引越しをすることにしました。就職する会社は、オフィスがいくつかの町にあって、日によって出勤するオフィスが違います。そこでAさんは,どこのオフィスに 行くにも時間の短い町に住もうと考えました。そこであなたは、Aさんを助けるため、住むのに一番便利な町を探すことになりました。町には 0 から始まる番号が振られており、町と町の間には道...原创 2019-03-22 17:13:20 · 166 阅读 · 0 评论 -
(甲)1030 Travel Plan (30 分)
题目: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 p...原创 2019-05-19 10:16:53 · 590 阅读 · 0 评论