hdu 1690 Bus System 最短路(Dijkstra算法)(二)
i <= 4; i++) scanf("%I64d",&l[i]); for(i = 1; i <= 4; i++) scanf("%I64d",&c[i]); scanf("%I64d%I64d",&n,&m); for(i = 1; i <= n; i++) scanf("%I64d",&x[i]); for(i = 1; i <= n; i++) for(j = 1; j <= n; j++) { if(i == j) w[i][j] = 0; else { int temp = abs(x[i] - x[j]); if(temp > 0 && temp <= l[1]) w[i][j] = w[j][i] = c[1]; else if(temp > l[1] && temp <= l[2]) w[i][j] = w[j][i] = c[2]; else if(temp > l[2] && temp <= l[3]) w[i][j] = w[j][i] = c[3]; else if(temp > l[3] && temp <= l[4]) w[i][j] = w[j][i] = c[4]; else if(temp >
l[4]) w[i][j] = w[j][i] = INF; } } __int64 u, v; printf("Case %I64d:\n",++cas); for(i = 0; i < m; i++) { scanf("%I64d%I64d",&u, &v); Dijkstra(n, u); if(d[v] == INF) printf("Station %I64d and station %I64d are not attainable.\n", u, v); else printf("The minimum cost between station %I64d and station %I64d is %I64d.\n",u, v, d[v]); } } return 0; }