-
Notifications
You must be signed in to change notification settings - Fork 14
/
10245.cpp
31 lines (31 loc) · 980 Bytes
/
10245.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
#include<iostream>
#include<cmath>
using namespace std;
int main(){
for(;;){
long long n,i,j;
cin>>n;
if(n==0)
break;
double cood[n][2];
for(i=0;i<n;i++)
cin>>cood[i][0]>>cood[i][1];
if(n==1){
cout<<"INFINITY\n";
continue;
}
double min=sqrt(pow((cood[0][0]-cood[1][0]),2)+pow((cood[0][1]-cood[1][1]),2));
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
double dis=sqrt(pow((cood[i][0]-cood[j][0]),2)+pow((cood[i][1]-cood[j][1]),2));
if(dis<min)
min=dis;
}
}
if(min>=10000)
cout<<"INFINITY\n";
else
printf("%.4lf\n",min);
}
return 0;
}