Pagini recente » Cod sursa (job #2866151) | Cod sursa (job #3288250) | Cod sursa (job #3258114) | Cod sursa (job #1222325) | Cod sursa (job #409820)
Cod sursa(job #409820)
#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;
}