// Calculate the maximum transport volume from the start point to the end point // The transport volume depends on the maximum capacity of a single path // use Floyd Algorithm , Motion gauge # include <iostream >#include <map ># include <cstring> using namespace STD; # define maxn 201 # define INF 000000map <string, int> city; int weight [maxn] [maxn]; int edge [maxn] [maxn]; int t; int N, R; int citynumber; int querycity (string Str) {Map <string, int>: iterator ITER; iter = city. find (STR); If (ITER! = City. end () {return ITER-> second;} else {City [STR] = citynumber; citynumber ++; return City [STR] ;}} void Floyd () {for (INT I = 1; I <= N; I ++) {for (Int J = 1; j <= N; j ++) {weight [I] [J] = edge [I] [J] ;}}for (INT I = 1; I <= N; I ++) {for (Int J = 1; j <= N; j ++) {for (int K = 1; k <= N; k ++) {weight [I] [J] = max (weight [I] [J], min (weight [I] [K], weight [k] [J]) ;}}} int main () {T = 0; while (CIN >>> n >> R) {If (n = 0 & R = 0) break; citynumber = 1; t ++; For (INT I = 0; I <= N; I ++) {edge [I] [I] = inf; For (Int J = 0; j <= N; j ++) {if (I! = J) edge [I] [J] = 0 ;}for (INT I = 0; I <r; I ++) {string ca, CB; int ton; cin> Ca> CB> ton; int x = querycity (CA); int y = querycity (CB); edge [x] [Y] = ton; edge [y] [x] = ton;} Floyd (); string CS, CE; CIN> Cs> CE; int ST = querycity (CS ); int en = querycity (CE); cout <"Scenario #" <t <Endl; cout <weight [st] [En] <"tons" <Endl;} return 0 ;}