コード例 #1
0
 public static void main(String[] args) {
   int N = StdIn.readInt();
   Point2D[] points = new Point2D[N];
   for (int i = 0; i < N; i++) {
     double x = StdIn.readDouble();
     double y = StdIn.readDouble();
     points[i] = new Point2D(x, y);
   }
   ClosestPair closest = new ClosestPair(points);
   StdOut.println(closest.distance() + " from " + closest.either() + " to " + closest.other());
 }