前面用dijstra写过了.但是捏.数据很小.也可以用Floyd来写. 注意题目里给出的是有向的权值. 附代码:#include<stdio.h>#include<string.h>#include<iostream>#define inf 0x1f1f1f1fusing namespace std; int n, a, b;int num;int dis[210][210];int i, j, k; int main(){ while (cin >>…
POJ 1847 Tram (最短路径) Description Tram network in Zagreb consists of a number of intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the intersection. When the tram ent…