Cod sursa(job #1907261)

Utilizator aeromaniaXRadoi Iulian aeromaniaX Data 6 martie 2017 18:31:32
Problema Cele mai apropiate puncte din plan Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.77 kb
#include <bits/stdc++.h>
using namespace std;
#define mod 9973
struct meh
{
    int x,y;
}a[100001];
double Min;
int n;
bool cmp1(meh a,meh b)
{
    return (a.x<b.x || (a.x==b.x && a.y<b.y));
}
bool cmp2(meh a,meh b)
{
    return (a.x>b.x || (a.x==b.x && a.y>b.y));
}

double d(meh a,meh b)
{
    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
void cit()
{
    freopen("cmap.in","r",stdin);
    freopen("cmap.out","w",stdout);
}
int main()
{
   cit();
    Min=999999999;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d %d",&a[i].x,&a[i].y);



    for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++)
                if(i!=j)
                    Min=min(Min,d(a[i],a[j]));
    }


    printf("%lf",Min);
    return 0;


}