Cod sursa(job #409845)

Utilizator impulseBagu Alexandru impulse Data 3 martie 2010 21:38:18
Problema Cele mai apropiate puncte din plan Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.69 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);
    vector<double> dst(0);
    for(int c = 0; c < n; c++)
    {
        int x,y;
        fin>>x>>y;
        xs[c] = x;
        ys[c] = y;
        for(int d = 0; d < c; d++)
        {
            double dsts = sqrt((xs[c] - xs[d])*(xs[c] - xs[d]) + (ys[c] - ys[d])*(ys[c] - ys[d]));
            dst.push_back(dsts);
        }
    }
    sort(dst.begin(), dst.end());
    for(int c = 0; c < n; c++)
    if(dst[c] != 0){
        fout<<dst[c];break;}
    return 0;
}