uva 11280 2点間の最短距離を求める(図中はk個のノードを超えない)


#include
#include
#include
#include
#define INF 0x3f3f3f3f
using namespace std;
mapmp;
string s,s1,s2;
int n,m,q,dp[1010][1010],x[1010],y[1010],c[1010];
void solve(){
	for(int i=1;i>s;
			mp[s]=i;
		}
		scanf("%d",&m);
		for(int i=0;i>s1>>s2;
			x[i]=mp[s1];
			y[i]=mp[s2];
			scanf("%d",&c[i]);
		}
		solve();
		if(t!=1)
		printf("
"); printf("Scenario #%d
",t++); scanf("%d",&q); while(q--){ int x; scanf("%d",&x); if(x+1>=n) x=n-1; if(dp[n-1][x+1] == INF) printf("No satisfactory flights
"); else printf("Total cost of flight(s) is $%d
",dp[n-1][x+1]); } } }