Cod sursa(job #409809)

Utilizator impulseBagu Alexandru impulse Data 3 martie 2010 21:21:25
Problema Cele mai apropiate puncte din plan Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.66 kb
#include<fstream>
#include<vector>
#include<math.h>
using namespace std;
int main()
{
    int n;
    ifstream fin("cmap.in");
    ofstream fout("cmap.out");
    fin>>n;
    vector<int> xs(n);
    vector<int> ys(n);
    int c, d;
    double min = 2400000000;
    for(c = 0; c < n; c++)
    {
        int x,y;
        fin>>x>>y;
        xs[c] = x;
        ys[c] = y;
    }
    vector<double> dst(0);
    for(int c = 0; c < n; c++)
        for(int d = 0; d < n; d++)
        {
            double dst = sqrt((xs[c] - xs[d])*(xs[c] - xs[d]) + (ys[c] - ys[d])*(ys[c] - ys[d]));
            if(dst > 0) if(min > dst) min = dst;
        }
    fout<<min;
}