Programming: the first event center in the US preliminary round

Source: Internet
Author: User

Question 3: Activity Center time limit: 256 ms single point time limit: Ms memory limit: MB

Description

City A is A highly planned city, but residents cannot forget to exercise and exercise in high-tech areas, therefore, when designing City A, the Urban Planning Bureau should also consider building an activity center for residents so that residents living in City A can exercise and exercise their bodies and minds at any time.

The City Planning Bureau wants the location of the activity center to meet the following conditions:

1. The total distance to all places of residence is the smallest.

2. To facilitate resource supply and maintenance of other equipment in the activity center, the activity center must be built on the main road of City.


To simplify the problem, we put City A on A two-dimensional plane. The main road of the city is regarded as the X axis of the Cartesian coordinate system, and all the places of residence in the city can be considered as A point on the two-dimensional plane.

Now, City Planning Bureau A wants to know where the activity center is best.


Input

The first row contains a number T, indicating the number of data groups.

Next, it contains the T group of data. The first row of each group contains an integer N, indicating that there are N places of residence in City.

The next N rows represent the coordinates of each place of residence.


Output

For each group of data, a row "Case X: Y" is output. X indicates the number of each group of data (starting from 1), and Y indicates the optimal construction position of the activity center. We recommend that you retain the value of Y to 6 digits or more after the decimal point. Any result with an absolute error or relative error less than 10-6 from the standard answer will be considered correct.


Data range

Small Data: 1 ≤ T ≤ 1000, 1 ≤ N ≤ 10

Big Data: 1 ≤ T ≤ 10, 1 ≤ N ≤105

For all data, the coordinate value is an integer and the absolute value cannot exceed 106



Example

Example 1: the optimal construction position of the activity center is (1.678787, 0)



Sample Input
131 12 23 3
Sample output
Case 1: 1.678787

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.