Pagini recente » Cod sursa (job #1215223) | Cod sursa (job #1160770) | Cod sursa (job #3293124) | Cod sursa (job #2834832) | Cod sursa (job #796639)
Cod sursa(job #796639)
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n,i,j;
double dist,d;
struct cc {int x,y;} p[100001];
int cmp(cc a,cc b)
{
if(a.x>b.x)
return 0;
return 1;
}
int main()
{
freopen("cmap.in","r",stdin);
freopen("cmap.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;++i)
scanf("%d%d",&p[i].x,&p[i].y);
sort(p+1,p+n+1,cmp);
d=1000000000ll;
for(i=1;i<=n;++i)
for(j=i+1;j<=i+7&&j<=n;++j)
{
dist=sqrt(double(pow((double)(p[i].x-p[j].x),double(2)))+double(pow((double)(p[i].y-p[j].y),double(2))));
if(dist<d)
d=dist;
}
printf("%.6lf",d);
return 0;
}