-
Notifications
You must be signed in to change notification settings - Fork 14
/
10246.cpp
59 lines (56 loc) · 1.21 KB
/
10246.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define sqr(X) ((X) * (X))
#define FOI(I, A, B) for (I = A; I <= B; I++)
struct Cod{
double X;
double Y;
};
int main(){
//freopen("testI.txt", "r", stdin);
//freopen("testO.txt", "w", stdout);
for (int t = 1; ; t++){
int N;
cin >> N;
if (N == 0)
break;
Cod frog[N];
int i, j, k;
FOI(i, 0, N-1)
cin >> frog[i].X >> frog[i].Y;
double mat[N][N];
FOI(i, 0, N-1)
FOI(j, 0, N-1)
mat[i][j] = sqrt(sqr(frog[i].X - frog[j].X) + sqr(frog[i].Y - frog[j].Y));
FOI(k, 0, N-1)
FOI(i, 0, N-1)
FOI(j, 0, N-1)
mat[i][j] = min(mat[i][j], max(mat[i][k], mat[k][j]));
printf("Scenario #%d\nFrog Distance = %.3lf\n\n", t, mat[0][1]);
}
return 0;
}