Pagini recente » Cod sursa (job #2350784) | Cod sursa (job #1636671) | Cod sursa (job #2130836) | Cod sursa (job #2609546) | Cod sursa (job #1016575)
#include<iostream>
#include<math.h>
#include<fstream>
#include<iomanip.h>
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 u,n,x[1000],y[1000],i,j;
float lung[10001];
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(21) << min << '\n';
f.close();
g.close();
return 0;
}