1#include <iostream>2#include <cstdio>3#include <cmath>4 #defineEPS 1e-65 #defineM 156 using namespacestd;7 DoubleA[m],b[m][m];8 intN;9 intMain ()Ten { Onescanf"%d",&n); A for(intI=1; i<=n;i++) -scanf"%LF",&a[i]); - for(intI=1; i<=n;i++) the for(intj=1; j<=n;j++) - { - DoubleT; -scanf"%LF",&t); +b[i][j]=2* (ta[j]); -b[i][n+1]+=t*t-a[j]*A[j]; + } A for(intI=1; i<=n;i++) at { - intto ; - for(to=i;to<=n;to++) - if(b[to][i]!=0) - Break; - if(i!=to ) in for(intj=1; j<=n+1; j + +) - swap (b[i][j],b[to][j]); to Doublet=B[i][i]; + for(intj=i;j<=n+1; j + +) -B[i][j]/=T; the for(intj=1; j<=n;j++) * if(j!=i) $ {Panax Notoginsengt=B[j][i]; - for(intk=1; k<=n+1; k++) theb[j][k]-=t*B[i][k]; + } A } the for(intI=1; i<n;i++) +printf"%.3LF", b[i][n+1]); -printf"%.3lf\n", b[n][n+1]); $ return 0; $}
First assume that the two-dimensional, set the center for (x, y), that (x1-x) ^2+ (y1-y) ^2= (xk-x) ^2+ (yk-y) ^2
So n+1 can construct n equations and then Gaussian elimination. (Gaussian elimination will not look at the code will know)
Bzoj 1013: [JSOI2008] spherical space generator sphere