紊莫 @ 2023-01-14 10:54:49
rt。
//Author: Velvet on Luogu(uid=443675)
#include <bits/stdc++.h>
#define mkpr make_pair
#define fi first
#define se second
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define dF(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
using namespace __gnu_cxx;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if (x < 0) x = ~x + 1, putchar('-');if (x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(int x){write(x);putchar('\n');}
inline void writesp(int x){write(x);putchar(' ');}
inline int lowbit(int x) {return x&(-x);}
typedef pair<int,int> Pair;
const int N=105;
int n;
double a[N][N],b[N];
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;
F(i,1,n){
F(j,1,n) cin>>a[i][j];
cin>>b[i];
}
F(i,1,n){//x_i
F(j,i,n){
if(a[j][i]!=0){
F(k,1,n) swap(a[i][k],a[j][k]);
swap(b[i],b[j]);
}
}
F(j,1,n){
if(j!=i){
double r=a[j][i]/a[i][i];
F(k,i,n) a[j][k]-=a[i][k]*r;
b[j]-=b[i]*r;
}
}
}
F(i,1,n){
int flag=1;
F(j,1,n){
if(a[i][j]!=0) flag=0;
}
if(flag&&fabs(b[i])>1e-8) {
cout<<"-1";return 0;
}
}
F(i,1,n){
int flag=1;
F(j,1,n){
if(a[i][j]!=0) flag=0;
}
if(flag&&fabs(b[i])==0){
cout<<"0";return 0;
}
}
F(i,1,n){
double ans=b[i]/a[i][i];if(ans==-0) ans=0;
cout<<"x"<<i<<"="<<fixed<<setprecision(2)<<ans<<endl;
}
return 0;
}