Pagini recente » Cod sursa (job #2909426) | Cod sursa (job #876915) | Cod sursa (job #246557) | Cod sursa (job #3134103) | Cod sursa (job #3164360)
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cmath>
#warning That's the baby, that's not my baby
typedef long long ll;
typedef long double ld;
const ld BULAN = 7;
const ld PI = 4 * atan(1);
struct Point {
ld x, y;
bool operator < (const Point &aux) const {
return (x == aux.x? y < aux.y : x < aux.x);
}
};
ld dist (Point a, Point b) {
return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
freopen("cmap.in", "r", stdin);
freopen("cmap.out", "w", stdout);
ld alpha = BULAN * 2e-3 * PI;
ld coss = cos(alpha);
ld sinn = sin(alpha);
int n;
std::cin >> n;
std::vector<Point> a(n);
for (int i = 0; i < n; i++) {
ld x, y;
std::cin >> x >> y;
a[i] = {coss * x + sinn * y, -sinn * x + coss * y};
}
std::sort(a.begin(), a.end());
ld answer = 1e18;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n && a[j].x - a[i].x <= answer; j++) {
answer = std::min(answer, dist(a[i], a[j]));
}
}
std::cout << std::fixed << std::setprecision(8) << answer;
return 0;
}