P16636 [CodeChef] CPOINT
提高-
题目描述

Given a set of N integer points on the Cartesian plane. Your task is to find an integer point satisfying its sum of distances to N given points (S) is minimum.

------ Input ------

There are several test cases (fifteen at most), each formed as follows:
The first line contains a positive integer N (N ≤ 2,000).
N lines follow, each containing a pair of integers (each having an absolute value of 10^{9} at most) describing coordinates of a given point.

The input is ended with N = 0.

------ Output ------

For each test case, output on a line a real number (with exactly 6 decimal places) which is the respective minimum sum S found.

----- Sample Input 1 ------
3
1 1
2 2
3 3
5
1 4
2 3
5 2
3 5
4 1
0

----- Sample Output 1 ------
2.828427
9.640986

输入格式

见题面

输出格式

见题面

样例输入
3 1 1 2 2 3 3 5 1 4 2 3 5 2 3 5 4 1 0
样例输出
2.828427 9.640986