시간 제한메모리 제한제출정답맞힌 사람정답 비율
서브태스크 참고 (추가 시간 없음) 1024 MB43375.000%

문제

There are N weighted points in a plane. Point i is at (XiYi) and has weight Wi.

In this problem, we need to find a special center of these points. The center is a point (XY) such that the sum of max(|X-Xi|, |Y-Yi|)*Wi is minimum.

입력

The input starts with one line containing exactly one integer T, which is the number of test cases. T test cases follow.

Each test case begins with one line containing one integer NN lines follow. Each line contains three space-separated real numbers XiYi, and WiXiYi and Wi 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 max(|X-Xi|, |Y-Yi|)*Wi for center (XY).

y will be considered correct if it is within an absolute or relative error of 10-6 of the correct answer.

제한

  • 1 ≤ T ≤ 10.
  • -1000.00 ≤ Xi ≤ 1000.00.
  • -1000.00 ≤ Yi ≤ 1000.00.

Test Set 1 (13점)

시간 제한: 20 초

  • 1 ≤ N ≤ 100;
  • Wi = 1.0, for all i.

Test Set 2 (21점)

시간 제한: 40 초

  • 1 ≤ N ≤ 10000;
  • 1.0 ≤ Wi ≤ 1000.0, for all i.

예제 입력 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

채점 및 기타 정보

  • 예제는 채점하지 않는다.