Pagini recente » Cod sursa (job #2895368) | Cod sursa (job #158654) | Cod sursa (job #755939) | Cod sursa (job #1876560) | Cod sursa (job #2406164)
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
ifstream f("cmap.in");
ofstream g("cmap.out");
//--------------------------------
//Variabile globale
int n;
pair<double,double>v[100001];
//--------------------------------
//Functii
void citire();
void rezolvare();
//--------------------------------
int main()
{
citire();
rezolvare();
return 0;
}
//--------------------------------
void rezolvare()
{
double mi = 1000000000000;
sort(v + 1,v + n + 1);
//g<<v[100].y<<" "<<v[100].y*v[100].y<<'\n';
for(int i = 1; i <= n; ++i)
for(int j = i + 1; j <= n,j <= i + 8; ++j)
{
unsigned long long x = abs((v[i].x - v[j].x)) * abs((v[i].x - v[j].x));
unsigned long long y = x+abs((v[i].y - v[j].y)) * abs((v[i].y - v[j].y));
double a = sqrt(y);
if(a < mi)
mi = a;
}
g << setprecision(7) << fixed << mi;
}
//--------------------------------
void citire()
{
f >> n;
for(int i = 1; i <= n; ++i)
f >> v[i].x >> v[i].y;
}