Cod sursa(job #855728)

Utilizator andreidanAndrei Dan andreidan Data 15 ianuarie 2013 15:50:18
Problema Cele mai apropiate puncte din plan Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.59 kb
#include <cstdio>
#include <cmath>

struct puncte{
    int x,y;
};
puncte a[100000];

int main(){
    int i,j,n;
    double min = 12311234342;
    double op;
    freopen("cmap.in","r", stdin);
    freopen("cmap.out","w", stdout);

    scanf("%d", &n);

    for(i = 1; i <= n; ++i)
        scanf("%d %d", &a[i].x, &a[i].y);

    for(i = 1; i <= n; ++i)
        for(j = 1; j <= n; ++j){
            op = ((a[i].x - a[j].x) * (a[i].x - a[j].x)) + ((a[i].y-a[j].y)*(a[i].y-a[j].y));
            if(op < min && i != j) min = op;
            }

    printf("%lf", sqrt(min));

}