Topic:
http://www.lydsy.com/JudgeOnline/problem.php?id=1013
Exercises
Consider the two-dimensional we can understand a truth:
Two points to the left can represent an equation, and then subtract from the 22 equation to get a one-time equation
So we can do it with Gaussian elimination.
#include <cstdio>#include<algorithm>#include<cstring>#include<cmath>#defineN 13using namespacestd;intn,m;DoubleC[n][n],f[n][n],ans[n];inlinevoidGauss () { for(intI=1; i<=n;i++) { intL=i; for(intj=l+1; j<=n;j++) if(Fabs (F[l][i]) < Fabs (F[j][i]) l=J; if(l!=i) for(intj=i;j<=m;j++) Swap (f[l][j],f[i][j]); for(intj=i+1; j<=n;j++) { Doubletemp=f[j][i]/F[i][i]; for(intk=i;k<=m;k++) F[j][k]=f[j][k]-f[i][k]*temp; } } for(inti=n;i>=1; i--) { Doublet=F[i][m]; for(intj=n;j>i;j--) T-=ans[j]*F[i][j]; Ans[i]=t/F[i][i]; }}intMain () {scanf ("%d", &n); m=n+1; for(intI=0; i<=n;i++) for(intj=1; j<=n;j++) scanf ("%LF",&C[i][j]); for(intI=1; i<=n;i++) { intj=i-1;DoubleD=0; for(intk=1; k<=n;k++) {F[i][k]= (C[i][k]-c[j][k]) *2; D+=c[i][k]*c[i][k]-c[j][k]*C[j][k]; } F[i][m]=D; } Gauss (); for(intI=1; i<=n;i++) if(i<n) printf ("%.3LF", Ans[i]); Elseprintf"%.3lf\n", Ans[i]); return 0;}
Bzoj 1013 [JSOI2008] spherical space Generator Sphere | Gaussian elimination element