Cod sursa(job #3263200)

Utilizator M132M132 M132 M132 Data 13 decembrie 2024 20:03:14
Problema Cele mai apropiate puncte din plan Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.67 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f ("cmap.in");
ofstream g ("cmap.out");

const int NMAX = 100000;
int x[NMAX + 5], y[NMAX + 5];

int main()
{
    int n, i, j;
    f >> n;
    for(i = 1; i <= n; ++i)
    {
        f >> x[i] >> y[i];
    }
    long long minim, distanta;
    minim = (x[1] - x[2])*(x[1] - x[2]) + (y[1] - y[2])*(y[1] - y[2]);
    for(i = 1; i <= n; ++i)
    {
        for(j = i + 1; j <= n; ++j)
        {
            distanta = (x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]);
            minim = min(minim, distanta);
        }
    }
    g << setprecision(6) << fixed << sqrt(minim);
    return 0;
}