Pagini recente » Cod sursa (job #622530) | Cod sursa (job #2887178) | Cod sursa (job #1649480) | Cod sursa (job #997791) | Cod sursa (job #1188320)
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#define putere(a,b) ((a-b)*(a-b))
const int MAX = 1<<17;
using namespace std;
struct puncte{
double x,y;
};
ifstream fin ("cmap.in");
ofstream fout ("cmap.out");
puncte q[MAX];
inline bool cmp(puncte a,puncte b){
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
double dist(puncte a,puncte b){
return sqrt((double)putere(a.x,b.x)+(double)putere(a.y,b.y));
}
int main()
{
int n;
fin>>n;
for(register int i=1;i<=n;++i)fin>>q[i].x>>q[i].y;
sort(q+1,q+n+1,cmp);
double d=1<<29;
for(register int i=1;i<=n;++i){
for(register int j=i+1;j<=n;++j){
double prec=dist(q[i],q[j]);
if(prec>d)break;
else d=prec;
}
}
fout<<fixed<<setprecision(6)<<d<<'\n';
return 0;
}