Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimming and instead reach her by jumping.
Unfortunately Fiona's stone is out of his jump range. Therefore Freddy considers to use other stones as intermediate stops and reach her by a sequence of several small jumps。
To execute a given sequence of jumps, a frog's jump range obviously must be at least as long as the longest jump occuring in the sequence.
The frog distance (humans also call it minimax distance) between two stones therefore is defined as the minimum necessary jump range over all possible paths between the two stones.

You are given the coordinates of Freddy's stone, Fiona's stone and all other stones in the lake. Your job is to compute the frog distance between Freddy's and Fiona's stone.

Input
The input will contain one or more test cases. The first line of each test case will contain the number of stones n (2<=n<=200). The next n lines each contain two integers xi,yi (0 <= xi,yi <= 1000) representing the coordinates of stone #i. Stone #1 is Freddy’s stone, stone #2 is Fiona’s stone, the other n-2 stones are unoccupied. There’s a blank line following each test case. Input is terminated by a value of zero (0) for n.
Output
For each test case, print a line saying “Scenario #x” and a line saying “Frog Distance = y” where x is replaced by the test case number (they are numbered from 1) and y is replaced by the appropriate real number, printed to three decimals. Put a blank line after each test case, even after the last one.
Sample Input

2
0 0
3 4

3
17 4
19 4
18 5

0

Sample Output
Scenario #1
Frog Distance = 5.000
Scenario #2
Frog Distance = 1.414
思路:从公青蛙到母青蛙有多条道路,问,在这几条道路中找出每条道路中最长的边,这些边组成一个集合,再求这个集合中最小的数。这是一个无向图,可以构成完全图。
double ->lf
核心代码
g[i][j]:从i到j,能经过1->k的点的最短路。

for(int k = 1; k <= n; k++)
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
g[i][j] = min(g[i][j], max(g[i][k], g[k][j]));
/**
* From:
* Qingdao Agricultural University
* Created by XiangwangAcmer
* Date : 2019-10-03-09.33.52
* Talk is cheap.Show me your code.
*/
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<cctype>
#include<stack>
#include<map>
#include<string>
#include<cstdlib>
#define ll long long
using namespace std;
const ll maxn = 1e6 + 5;
const ll minn = 1e9 + 5;
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LIMIT = 4294967295LL;
const int N = 201;
//vector<int>v[maxn];
int dp[maxn];
double g[N][N];
bool row[maxn], col[maxn];
bool flag = 0;
int minnn = minn;
double x[maxn], y[maxn];
queue<int>q;///同dijk实现一样 可以解决负权问题
void floyd(int n) {
for(int k = 1; k <= n; k++)
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
g[i][j] = min(g[i][j], max(g[i][k], g[k][j]));

}

int main() {
ios::sync_with_stdio(false);
int n;
int cnt=0;
while(~scanf("%d",&n)&&n) {
memset(g, 0x3f, sizeof(g));
for(int i = 1; i <= n; i++)
g[i][i] = 0; ///初始化
for(int i = 1; i <= n; i++)
cin >> x[i] >> y[i];
for(int i = 1; i <= n; i++)
for(int j = i + 1; j <= n; j++)
g[i][j] = g[j][i] = (double)(sqrt(1.0 * (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])));
floyd(n);
printf("Scenario #%d\n",++cnt);
printf("Frog Distance = %.3lf\n\n",g[1][2]);
}
return 0;
}