
最短路
jiang_16
一个想学好编程的弱渣妹纸,猎奇,脑洞向...
展开
-
芳姐和芳姐的猪
芳姐特别喜欢猪,所以,她特意养了m个猪圈,顺便在k条无向边,每条边有都有起点v,距离.....芳姐和猪们约定好,每天去一个固定猪圈去吃饭,芳姐为了不累着她可爱的猪们,想知道所有的猪吃饭走的最短路程是多少?Input 第一行,猪的个数m(k(1(猪的编号为1..m)N+1行N头猪所在的猪圈号第n+k+1行:u、1m个猪圈连通。Output Ex原创 2017-08-09 20:44:06 · 445 阅读 · 0 评论 -
L2-001. 紧急救援
作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领你的救援队尽快赶往事发地,同时,一路上召集尽可能多的救援队。输入格式:输入第一行给出4个正整数N、M、S、D,其中N(2<=N<=500)是城市的个数,...原创 2018-03-14 21:10:13 · 257 阅读 · 0 评论 -
542. 01 Matrix
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1: Input:0 0 00 1 00 0 0Output:0 0 00 1 00 0原创 2017-12-08 21:48:55 · 221 阅读 · 0 评论 -
Cow Contest Floyd
N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is un原创 2017-08-15 09:47:12 · 358 阅读 · 0 评论 -
Wormholes SPFA
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 that i原创 2017-08-14 23:46:44 · 281 阅读 · 0 评论 -
Silver Cow Party Dijkstra
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 ro原创 2017-08-11 15:58:33 · 249 阅读 · 0 评论 -
Heavy Transportation Dijkstra
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 cu原创 2017-08-11 15:41:03 · 172 阅读 · 0 评论 -
Frogger Dijkstra
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' sun原创 2017-08-11 15:31:09 · 220 阅读 · 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 get b原创 2017-08-10 09:26:07 · 177 阅读 · 0 评论 -
7-6 Harry Potter's Exam(25 分)
In Professor McGonagall's class of Transfiguration, Harry Potter is learning how to transform one object into another by some spells. He has learnt that, to turn a cat into a mouse one can say docamo...原创 2018-03-23 18:04:46 · 686 阅读 · 0 评论