- 清帝之惑之雍正
- 2015-07-08 10:33:35 @
//(x1-x2)^2+(y1-y2)^2
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
struct Coordinate{
double x,y;
}a[100005];
int cmp( const void *a , const void *b ) {
struct Coordinate *c=(Coordinate *)a;
struct Coordinate *d=(Coordinate *)b;
if(c->x!=d->x)
return d->x-c->x;
else return d->y-c->y;
}
int main (){
cin>>n;
for (int i=0;i<n;i++){
int d,f;
cin>>a[i].x>>a[i].y;
}
double min=1000000.0;
for(int i=0;i<n;i++){
for (int j=0;j<n;j++){if (a[i].x-a[j].x<min)
if (i!=j){
double x1=(a[i].x-a[j].x);
double y1=(a[i].y-a[j].y);
double ans=sqrt((double)abs(x1*x1)+(double)abs(y1*y1));
if (min>ans)
min=ans;
}
}
}
printf ("%.3f",min);
//while (1);
return 0;
}
2 条评论
-
qq872191552 LV 9 @ 2015-07-08 10:57:02
你在做聪明的质检员吗。。每次评测排队都看到你
-
2015-07-08 10:51:35@
终于AC了
- 1