http://www.lydsy.com/JudgeOnline/problem.php?id=1013
Set the spherical sphere (x1,x2,x3 ... )
The coordinates of the known point are t[i][j]
So for each I satisfies
Σ (T[i][j]-x[j]) ^2 =σ (T[0][j]-x[j]) ^2
Simplifying Open is (T[0][j]-t[i][j]) *x[j] = t[0][j]^2-t[i][j]^2
N of equations N unknowns
Gaussian elimination element
#include <cmath>#include<cstdio>#include<algorithm>using namespacestd;intN;Doublet[ the],a[ the][ the];voidGauss () {intR; DoubleF; for(intI=0; i<n;i++) {R=i; for(intj=i+1; j<n;j++) if(Fabs (A[j][i]) >fabs (A[r][i]) r=J; if(r!=i) for(intj=0; j<=n;j++) Swap (a[r][j],a[i][j]); for(intk=i+1; k<n;k++) {f=a[k][i]/A[i][i]; for(intj=i;j<=n;j++) a[k][j]-=f*A[i][j]; } } for(inti=n-1; i>=0; i--) { for(intj=i+1; j<n;j++) a[i][n]-=a[j][n]*A[i][j]; A[i][n]/=A[i][i]; }}intMain () {scanf ("%d",&N); for(intI=0; i<n;i++) scanf ("%LF",&T[i]); Doublex; for(intI=0; i<n;i++) for(intj=0; j<n;j++) {scanf ("%LF",&x); A[I][J]=2* (t[j]-x); A[i][n]+=t[j]*t[j]-x*x; } gauss (); for(intI=0; i<n-1; i++) printf ("%.3LF", A[i][n]); printf ("%.3LF", a[n-1][n]);}
1013: [JSOI2008] spherical space generator sphere time limit:1 Sec Memory limit:162 MB
submit:6307 solved:3266
[Submit] [Status] [Discuss] Description
There is a spherical space generator capable of producing a hard sphere in n-dimensional space. Now that you're trapped in this n-dimensional sphere, you only know the ball.
The coordinates of the n+1 points on the surface, you need to determine the spherical coordinates of the n-dimensional sphere as quickly as you can to destroy the sphere space generator.
Input
The first line is an integer N (1<=n=10). The next n+1 line, each row has n real numbers, representing the n-dimensional coordinates of a point on the sphere. Each real number is exactly the decimal point.
6 bits, and the absolute value is no more than 20000.
Output
With only one row, the n-dimensional coordinates (n real numbers) of the globe are given in turn, and two real numbers are separated by a space. Each real number is accurate to the decimal point
After 3 bits. Data is guaranteed to be solvable. Your answer must be the same as the standard output in order to score.
Sample Input2
0.0 0.0
-1.0 1.0
1.0 0.0Sample Output0.500 1.500HINT
Tip: Give two definitions: 1, Sphere: points that are equal to any point on the sphere. 2, Distance: Set two n for space on the point A, B
Coordinates for (A1, A2, ..., an), (B1, B2, ..., bn), the distance of AB is defined as: dist = sqrt ((A1-B1) ^2 + (A2-B2) ^2 +
... + (AN-BN) ^2)
Bzoj thousand plan 104:bzoj1013: [JSOI2008] spherical space generator sphere