N-dimensional Sphere

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3571
64-bit integer IO format: %I64d      Java class name: Main

Description

In an N-dimensional space, a sphere is defined as {(x1, x2 ... xN)| ∑(xi-Xi)^2 = R^2 (i=1,2,...,N) }. where (X1,X2…XN) is the center. You're given N + 1 points on an N-dimensional sphere and are asked to calculate the center of the sphere.

Input

The first line contains an integer T which is the number of test cases.
For each case there's one integer N on the first line.
Each of the N+1 following lines contains N integers x1, x2 ... xN describing the coordinate of a point on the N-dimensional sphere.
(0 <= T <= 10, 1 <= N <= 50, |xi| <= 10^17)

Output

For the kth case, first output a line contains “Case k:”, then output N integers on a line indicating the center of the N-dimensional sphere
(It's guaranteed that all coordinate components of the answer are integers and there is only one solution and |Xi| <= 10^17)

Sample Input

2
2
1 0
-1 0
0 1
3
2 2 3
0 2 3
1 3 3
1 2 4

Sample Output

Case 1:
0 0
Case 2:
1 2 3

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .