随笔分类 -  最短or最长路径

摘要:Time limit: 1 secondMemory limit: 1024 megabytesEagle Jump公司正在开发一款新的游戏。泷本一二三作为其员工,获得了提前试玩的机会。现在她正在试图通过一个迷宫。这个迷宫有一些特点。为了方便描述,我们对这个迷宫建立平... 阅读全文
posted @ 2018-08-04 16:55 Assassin_poi君 阅读(225) 评论(0) 推荐(0) 编辑
摘要:"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he ... 阅读全文
posted @ 2018-07-30 21:51 Assassin_poi君 阅读(118) 评论(0) 推荐(0) 编辑
摘要:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and ... 阅读全文
posted @ 2018-07-27 18:12 Assassin_poi君 阅读(149) 评论(0) 推荐(0) 编辑
摘要:算法步骤:a.初始时,S只包含源点,即S={v},v的距离为0。U包含除v外的其他顶点,即:U={其余顶点},若v与U中顶点u有边,则正常有权值,若u不是v的出边邻接点,则权值为∞。b.从U中选取一个距离v最小的顶点k,把k,加入S中(该选定的距离就是v到k的最短路径... 阅读全文
posted @ 2017-11-14 17:56 Assassin_poi君 阅读(143) 评论(0) 推荐(0) 编辑
摘要:正如我们所知道的,Floyd算法用于求最短路径。Floyd算法可以说是Warshall算法的扩展,三个for循环就可以解决问题,所以它的时间复杂度为O(n^3)。Floyd算法的基本思想如下:从任意节点A到任意节点B的最短路径不外乎2种可能,1是直接从A到B,2是从A... 阅读全文
posted @ 2017-10-12 16:33 Assassin_poi君 阅读(292) 评论(0) 推荐(0) 编辑
摘要:Time limit 5000 ms Memory limit 32768 kBXX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v... 阅读全文
posted @ 2017-09-30 10:11 Assassin_poi君 阅读(107) 评论(0) 推荐(0) 编辑
摘要:你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的... 阅读全文
posted @ 2017-08-08 17:22 Assassin_poi君 阅读(269) 评论(0) 推荐(0) 编辑
摘要:Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also ther... 阅读全文
posted @ 2017-08-05 16:41 Assassin_poi君 阅读(380) 评论(0) 推荐(0) 编辑
摘要:"Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but als... 阅读全文
posted @ 2017-08-05 14:22 Assassin_poi君 阅读(199) 评论(0) 推荐(0) 编辑
摘要:虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海... 阅读全文
posted @ 2017-08-03 10:41 Assassin_poi君 阅读(77) 评论(0) 推荐(0) 编辑
摘要:给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input:输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d... 阅读全文
posted @ 2017-08-02 21:00 Assassin_poi君 阅读(158) 评论(0) 推荐(0) 编辑
摘要: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 ... 阅读全文
posted @ 2017-08-02 15:26 Assassin_poi君 阅读(193) 评论(0) 推荐(0) 编辑
摘要: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 mor... 阅读全文
posted @ 2017-08-02 11:39 Assassin_poi君 阅读(116) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示