POJ2502:Subway(最短路)】的更多相关文章

题目链接:http://poj.org/problem?id=2502 Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don't want to…
L - Subway(最短路spfa) You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don't want to be late for class, you want…
Subway Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14634   Accepted: 4718 题目链接:http://poj.org/problem?id=2502 Description: You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your…
题目链接: 题意:在一个城市里有许多地铁,现在你知道每条地铁的起点  终点与停站点的坐标,知道我们的起始坐标与终点坐标,问加上走路最快到达终点的时间是多少? 方法:求出任意两点的车速时间与步行时间,再算出最短路 #include<stdio.h> #include<cstring> #include<cstdlib> #include<algorithm> #include<math.h> #include<queue> using…
题意 : 给出二维平面上的两个点代表起点以及终点,接下来给出若干条地铁线路,除了在地铁线路上行进的速度为 40km/h 其余的点到点间都只能用过步行且其速度为 10km/h ,现问你从起点到终点的最短路是多少? 分析 : 这题建完图之后就是裸的最短路了,在建图的时候需要注意地铁的站点之间不能隔点建拥有地铁行进速度的边,也就是若地铁线路为 A->B->C 那么则不能建 A->C 这条速度为 40km/h 的边,因为地铁是在节点间行进的,如果要跨站点那么只能通过步行.图中边的权值为 (两点间…
思路: 需要注意的地方:一条地铁线路并不一定和样例描述的那样是直的:同一条线路上的两个站点步行可能更快. 实现: #include <iostream> #include <cstdio> #include <cmath> using namespace std; , INF = 0x3f3f3f3f; int sx, sy, ex, ey; double dis[MAXN][MAXN]; struct node { int x, y; }; node a[MAXN];…
最短路径: poj1125 - Stockbroker Grapevine(多源最短路径,floyd) poj1502 - MPI Maelstrom(单源最短路径,dijkstra,bellman-ford,spfa) poj1511 - Invitation Cards(单源来回最短路径,spfa邻接表) poj1797 - Heavy Transportation(最大边,最短路变形,dijkstra,spfa,bellman-ford) poj2240 - Arbitrage(汇率问题,…
Subway 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/L Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the s…
Subway POJ-2502 这里除了直接相连的地铁站,其他图上所有的点都要连线,这里是走路的速度. 记住最后的结果需要四舍五入,否则出错. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<vector> #include<queue> #include<cmath…
//Accepted 504 KB 16 ms //spfa最短路 //把n个地铁站作为n个顶点,边权为从一个站到另一个站的时间 //注意:地铁在相邻的两站之间是直线行驶,但其他的就不是了 #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <cmath> #include <algorithm> using namesp…