Commits

danielmaxx  committed f96485b Merge

Merge branch 'master', remote-tracking branch 'origin/master'

  • Participants
  • Parent commits e5c5f29, 025bd7e

Comments (0)

Files changed (1)

File solutions/div2/sighting.cpp

-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <algorithm>
-#include <functional>
-#include <vector>
-
-using namespace std;
-
-const int MAXN = 1000;
-
-template <class T> struct point_t {
-    T x, y; point_t() {}
-    point_t(T x_, T y_) : x(x_), y(y_) {}
-};
-
-template<class T>
-double EuclidDistance(const point_t<T>& p1, const point_t<T>& p2) {
-    const double dx = p2.x - p1.x, dy = p2.y - p1.y;
-    return sqrt(dx * dx + dy * dy);
-}
-
-template<class T>
-pair<int, int> answer(vector<point_t<T> >& points) {
-    pair<int, int> result(0, 1);
-    double minDist = EuclidDistance(points[0], points[1]);
-    for (int i = 0; i < points.size(); ++i) {
-        for (int j = i+1; j < points.size(); ++j) {
-            const double dist = EuclidDistance(points[j], points[i]);
-            if (dist < minDist) minDist = dist, result = make_pair(i, j);
-        }
-    }
-    return result;
-}
-
-int main() {
-    int T; scanf("%d", &T);
-    for(int ic=1; ic<=T; ++ic) {
-        int N; scanf("%d", &N);
-        vector<point_t<double> > points(N);
-        for(int i=0; i<N; ++i) scanf("%lf %lf", &points[i].x, &points[i].y);
-        pair<int, int> closest = answer(points);
-        printf("Case #%d: %.2lf\n", ic, EuclidDistance(points[closest.first], points[closest.second]));
-    }
-    return 0;
-}