logo AlgoBeat OnlineJudge
登录 注册

#216634. [GKS 2017 #B] Center

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

样例

样例输入 1

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

样例输出 1

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.