Pagini recente » Cod sursa (job #433107) | Cod sursa (job #495017) | Cod sursa (job #3129452) | Cod sursa (job #2750586) | Cod sursa (job #980666)
Cod sursa(job #980666)
#include <cstdio>
#include <algorithm>
#include <cmath>
#define x first
#define y second
using namespace std;
typedef pair <int, int> point;
const int NMAX = 100003;
point P[NMAX];
long long square_distance (const point &a, const point &b) {
return (b.x - a.x) * 1LL * (b.x - a.x) + (b.y - a.y) * 1LL * (b.y - a.y);
}
int main () {
freopen ("cmap.in", "r", stdin);
freopen ("cmap.out", "w", stdout);
long long p, q;
int N, i, j;
scanf ("%d", &N);
for (i = 1; i <= N; ++i)
scanf ("%d%d", &P[i].x, &P[i].y);
sort (P + 1, P + N + 1);
q = square_distance (P[1], P[N]);
for (i = 1; i < N; ++i)
for (j = i + 1; j <= N; ++j) {
p = square_distance (P[i], P[j]);
if (1LL * (P[i].x - P[j].x) * (P[i].x - P[j].x) > q)
break;
if (p < q)
q = p;
}
printf ("%.6lf", sqrt (q));
}