#P16618. [GKS 2017 #B] Center
[GKS 2017 #B] Center
题目描述
There are weighted points in a plane. Point is at (, ) and has weight .
In this problem, we need to find a special center of these points. The center is a point (, ) such that the sum of is minimum.
输入格式
The input starts with one line containing exactly one integer , which is the number of test cases. test cases follow.
Each test case begins with one line containing one integer . lines follow. Each line contains three space-separated real numbers , , and . , and have exactly 2 digits after the decimal point.
输出格式
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the sum of for center (, ).
will be considered correct if it is within an absolute or relative error of of the correct answer.
3
2
0.00 0.00 1.00
1.00 0.00 1.00
4
1.00 1.00 1.00
1.00 -1.00 1.00
-1.00 1.00 1.00
-1.00 -1.00 1.00
2
0.00 0.00 1.00
1.00 0.00 2.00
Case #1: 1.0
Case #2: 4.0
Case #3: 1.0
提示
Limits
.
.
.
Small dataset (Test set 1 - Visible)
;
, for all i.
Large dataset (Test set 2 - Hidden)
;
, for all i.