数论进度开的好慢啊。我整天做的都是什么鬼题啊。

简单的高消题,用一个式子把另外$n$个有二次项和距离的式子全消掉就行了。

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define dbg(x) cerr << #x << " = " << x <<endl
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
template<typename T>inline T _min(T A,T B){return A<B?A:B;}
template<typename T>inline T _max(T A,T B){return A>B?A:B;}
template<typename T>inline char MIN(T&A,T B){return A>B?(A=B,):;}
template<typename T>inline char MAX(T&A,T B){return A<B?(A=B,):;}
template<typename T>inline void _swap(T&A,T&B){A^=B^=A^=B;}
template<typename T>inline T read(T&x){
x=;int f=;char c;while(!isdigit(c=getchar()))if(c=='-')f=;
while(isdigit(c))x=x*+(c&),c=getchar();return f?x=-x:x;
}
const int N=+;
db A[N][N],B[N][N];
int n,maxl; int main(){//freopen("test.in","r",stdin);//freopen("test.out","w",stdout);
read(n);
for(register int i=;i<=n+;++i)for(register int j=;j<=n;++j)scanf("%Lf",&B[i][j]);
for(register int i=;i<=n;++i){
for(register int j=;j<=n;++j)A[i][j]=*(B[n+][j]-B[i][j]);
for(register int j=;j<=n;++j)A[i][n+]+=B[n+][j]*B[n+][j]-B[i][j]*B[i][j];
}
for(register int i=;i<=n;++i){
maxl=i;
for(register int j=i+;j<=n;++j)if(fabs(A[j][i])>fabs(A[maxl][i]))maxl=j;
if(maxl^i)swap(A[maxl],A[i]);
for(register int l=;l<=n;++l)if(l^i)
for(register int j=n+;j>=i;--j)
A[l][j]-=A[l][i]/A[i][i]*A[i][j];
}
for(register int i=;i<=n;++i)printf("%.3Lf\n",A[i][n+]/A[i][i]);
return ;
}
05-11 19:53