See Chty Code
Original question:
Bzoj hung up ... All right, I'll fill the surface.
The coordinates of the center are (x, Y, z ...), the coordinates of the first point given (A,b,c ...)
Then this point to the center of the distance can be expressed: (a-x) ^2+ (b-y) ^2+ (c-z) ^2+......=a^2-2ax+x^2+b^2-2by+y^2+ ...
Then we give n points, assuming a point coordinates (a ', B ', C ' ...)
Two points to the center of the distance equal: A^2-2ax+x^2+b^2-2by+y^2+......=a ' ^2-2a ' x+x^2+b ' ^2-2b ' y+y^2+ ...
Move the non-unknowns to the side and the rest to the other side: 2 (a '-a) x+2 (b '-B) y+2 (c '-c) z+......=a ' ^2-a^2+b ' ^2-b^2+c ' ^2-c^2 ...
Then we can construct n equations based on the first point and the next n points.
Then you can happily use the Gaussian elimination to remove the spicy (but I Gaussian elimination of the template has not understood the + back)
Code:
1#include <iostream>2#include <cstdio>3#include <algorithm>4#include <cstring>5#include <cmath>6 using namespacestd;7 Doubleeps=1e-6;8 intN;9 Doubleb[ One],a[ One][ One];Ten voidGauss () { One intnow=1; A for(intI=1; i<=n;i++){ - inttemp=Now ; - while(Temp<=n &&!) (Fabs (A[temp][i]) >eps)) temp++; the if(temp>n)Continue; - if(temp!=Now ) - for(intj=1; j<=n+1; j + +) - swap (a[temp][j],a[now][j]); + DoubleC=A[now][i]; - for(intj=1; j<=n+1; j + +) a[now][j]/=C; + for(intj=1; j<=n;j++)if(j!=Now ) { AC=A[j][i]; at for(intk=1; k<=n+1; k++) -a[j][k]-=c*A[now][k]; - } -now++; - } - } in intMain () { - //freopen ("ddd.in", "R", stdin); toFreopen ("bzoj_1013.in","R", stdin); +Freopen ("Bzoj_1013.out","W", stdout); -Cin>>N; the Double_left; * for(intI=1; i<=n;i++) cin>>B[i]; $ for(intI=1; i<=n;i++)Panax Notoginseng for(intj=1; j<=n;j++){ -scanf"%LF",&_left); thea[i][j]=2* (_left-b[j]); +a[i][n+1]+=_left*_left-b[j]*B[j]; A } the Gauss (); + for(intI=1; i<=n;i++) printf ("%.3LF", a[i][n+1]); -cout<<Endl; $ return 0; $}
View Code
"BZOJ2013" "JSOI2008" spherical space generator