Pagini recente » Cod sursa (job #1788556) | Cod sursa (job #989052) | Cod sursa (job #1788540) | Cod sursa (job #1675224) | Cod sursa (job #1016690)
#include<iostream>
#include<math.h>
#include<fstream>
#include<iomanip>
using namespace std;
float fun ( int x1,int x2,int y1,int y2)
{float s;
s=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
return s;}
int main()
{int n,x[1000],y[1000],i,j;
float lung[1000];
ifstream f("cmap.in");
ofstream g("cmap.out");
f>>n;
for(i=1;i<=n;i++)
f>>x[i]>>y[i];
int c=0;
for(i=1;i<n;i++)
for(j=1+i;j<=n;j++)
{
c++;
lung[c]=fun(x[i],x[j],y[i],y[j]);
}
float min=lung[1];
for(j=i;j<=c;j++)
if(min>lung[j])
min=lung[j];
g<< setprecision(10) << min << '\n';
f.close();
g.close();
return 0;
}