Cod sursa(job #409820)

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