题目链接:https://vjudge.net/problem/UVA-10048
题意:水题。给c个点s条边的无向图,q次询问,求两点之间最大权值最小的路径。Floyd跑一遍出结果。
/*
* @Author: SamsonHo
* @Date: 2018-10-16-22.37.25
* @URL:
*/
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 1e5+10;
int a[105][105];
int main(void)
{
int c,q,s,u,v,d,kase = 0;
while(~scanf("%d%d%d",&c,&s,&q) && c+s+q)
{
memset(a,INF,sizeof a);
for(int i = 1; i <= s; ++i)
{
scanf("%d%d%d",&u,&v,&d);
a[u][v] = a[v][u] = d;
}
for(int k = 1; k <= c; ++k)
{
for(int i = 1; i <= c; ++i)
{
for(int j = 1; j <= c; ++j)
{
a[i][j] = min(a[i][j],max(a[i][k],a[k][j]));
}
}
}
if(kase) puts("");
printf("Case #%d\n",++kase);
while(q--)
{
scanf("%d%d",&u,&v);
if(a[u][v] == INF)
printf("no path\n");
else
printf("%d\n",a[u][v]);
}
}
}