Pagini recente » Cod sursa (job #1302681) | Cod sursa (job #1047307) | Cod sursa (job #2763803) | Cod sursa (job #3271013) | Cod sursa (job #2118175)
#include <bits/stdc++.h>
#define Nmax 100005
#define valmax 1000000000
using namespace std;
ifstream fin ("cmap.in");
ofstream fout ("cmap.out");
pair <long double, long double> v[Nmax];
int n;
long double ans = valmax;
long double distanta (pair <long double, long double> a, pair <long double, long double> b)
{
long double d1 = (a.first-b.first)*(a.first-b.first);
long double d2 = (a.second-b.second)*(a.second-b.second);
return sqrt(d1+d2);
}
void solve ()
{
for ( int i = 1; i < n; ++i )
for ( int j = i+1; j <= n && (v[j].first-v[i].first < ans || v[j].second-v[i].second < ans ); ++j )
ans = min(ans, distanta(v[i], v[j]));
fout<<setprecision(8)<<ans;
}
void read()
{
fin>>n;
for ( int i = 1; i <= n; ++i )
fin>>v[i].first>>v[i].second;
sort(v+1, v+n+1);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
read(); solve();
}