HDU Today HDU - 2112
用的map映射为整数,后面就和普通的最短路一样的,注意头文件。 #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <map> using namespace std ; #define inf 10000000 int a [ 505 ][ 505 ], book [ 505 ], dis [ 505 ]; int n , m ; char b [ 35 ], c [ 35 ]; int flag ; void init () { n = 0 ; flag = 0 ; memset ( book , 0 , sizeof ( book )); for ( int i = 0 ; i <= 155 ; i ++){ for ( int j = 0 ; j <= 155 ; j ++){ a [ i ][ j ]= inf ; } } map < string , int > station ; station . clear (); scanf ( "%s%s" , b , c ); if ( strcmp ( b , c )== 0 ){ flag = 1 ;