![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路径
Astralis的Xyp9x本 人
这个作者很懒,什么都没留下…
展开
-
Subway
小k要从家去学校,他可以选择步行或者地铁,步行的速度是10km/h,地铁的速度是40km/h。假设小k非常的幸运,每次他到地铁站就立刻会有地铁。小k可以随意上下地铁,并且可以在地铁线路之间转换。所有的地铁运行都是双向的。 Input 输入第一行包括家和学校的x,y坐标,接下来是若干条地铁线。 每条地铁线包括站点的x,y坐标,有序排列,假设地铁在相邻的两站之间直线运行,每条地铁线至少有两个站,地...原创 2020-02-04 10:05:17 · 148 阅读 · 0 评论 -
Cow Contest
FJ的N(1 <= N <= 100)头奶牛们最近参加了场程序设计竞赛:)。在赛场上,奶牛们按1..N依次编号。每头奶牛的编程能力不尽相同,并且没有哪两头奶牛的水平不相上下,也就是说,奶牛们的编程能力有明确的排名。 整个比赛被分成了若干轮,每一轮是两头指定编号的奶牛的对决。如果编号为A的奶牛的编程能力强于编号为B的奶牛(1 <= A <= N; 1 <= B <...原创 2020-02-03 15:34:20 · 154 阅读 · 0 评论 -
106 miles to Chicago
题目: 输入顶点数和边的条数以及从无向边,不同的是表示从a到b不被抓住的概率是p 计算并输出从1到n他们不被抓住的最大概率; 又是一道乘积最长路问题; 代码: #include<iostream> #include<algorithm> #include<string.h> #include<stdio.h> using namespace...原创 2020-02-03 15:14:44 · 131 阅读 · 0 评论 -
Tram
题目: 给出站点以及起点和终点,在每个站点,给出该站点可以到达地的站点个数(可以认为两个站点之间可以到达那么距离为1),求出起点与终点最短距离; 代码: #include<iostream> #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm&g...原创 2020-02-03 14:42:25 · 133 阅读 · 0 评论 -
MPI Maelstrom
题目: 实验室有很多台计算机,由于每个人计算机的性能不同,导致计算机之间发送信息的速度不同,所以花费时间不同。 消息从第一台电脑发送到第二台电脑后,这两台电脑能再向其他电脑发送消息,就是一种类似二叉树的结构。 当然并不是真正的二叉树——我们的计算机有一些特殊的特性,我们应该加以利用。 我们的计算机允许同时向连接到它的任意数量的其他计算机发送消息。 然而,消息不一定...原创 2020-02-03 13:46:33 · 493 阅读 · 0 评论 -
Invitation Cards
题目: n-1个人从1号点出发,到剩余n-1个宣传点,然后再回到1号点汇报结果,求所有人往返路径和的最小值 Input 输入由T个案例组成。输入的第一行只包含正整数T。 接下来是N和M,1 <= N,M <= 1000000,表示N个点和连接N个点的M条边。 然后有M行,每行包括三个值U,V,W,表示从点U到点V需要W的路程。你可以假设该图连通。 注意是单向通道!!! Outp...原创 2020-02-03 13:22:39 · 216 阅读 · 0 评论 -
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 Dollar buys 0.5 B...原创 2020-02-03 11:17:50 · 75 阅读 · 0 评论 -
Cow Hurdles
题目: Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they want to be able to us...原创 2020-02-03 10:43:45 · 149 阅读 · 0 评论 -
E-find the safest road
题目: XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600 想出去旅游,面对这这么多的路,他想找一条最安全的路。但是8600 的数学不好,想请你帮忙 ^...原创 2020-02-03 10:16:35 · 134 阅读 · 0 评论 -
Choose the best route
题目: One 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, ...原创 2020-02-03 09:44:23 · 129 阅读 · 0 评论 -
A strange lift
题目: There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor...原创 2020-02-02 21:58:36 · 157 阅读 · 0 评论 -
Dijkstra 畅通工程续
题目: 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input 本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(0<N<200,0...原创 2020-02-02 21:18:06 · 131 阅读 · 0 评论 -
一个人的旅行
题目: A - 一个人的旅行 题意: 中文不在多说,多个起点,将这多个起点与0之间的长度定为0,最后输出多个终点中最小的距离即可; 事实上这道题使用dijkstra很方便就可以得出,但是很久没有做类似的题目,想使用一下邻接表优化的spfa; 第一次代码: //wa未找到原因 #include<iostream> #include<stdio.h> #inclu...原创 2020-02-01 22:44:34 · 110 阅读 · 0 评论 -
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) unidirectional (one-way ...原创 2018-07-15 20:26:34 · 80 阅读 · 0 评论 -
Heavy Transportation
题目:Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his c...原创 2018-07-15 16:02:40 · 112 阅读 · 0 评论 -
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-07-15 14:53:46 · 123 阅读 · 0 评论 -
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 sleep, so she wants to ge...原创 2018-07-15 13:25:37 · 76 阅读 · 0 评论 -
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 tha...原创 2018-07-16 15:51:15 · 201 阅读 · 0 评论 -
Currency Exchange
题目:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There ...原创 2018-07-16 14:58:10 · 834 阅读 · 0 评论