题意:求任意两点之间的距离的最少一个距离
思路:枚举一下就可以了
#include <iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define N 10010
struct node{
double x,y;
}p[N];
int main(int argc, char** argv) {
int n,i,j;
double mdist,tmp;
while(scanf("%d",&n)&&n){
for(i=0;i<n;i++){
scanf("%lf%lf",&p[i].x,&p[i].y);
}
mdist=0xfffffff;
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
tmp=(p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y);
mdist=min(mdist,tmp);
}
}
mdist=sqrt(mdist);
if(mdist>=10000)
printf("INFINITY\n");
else
printf("%.4lf\n",mdist); }
return 0;
}