1 #include<bits/stdc++.h> 2 using namespace std; 3 int n; 4 struct matrix{ 5 double mat[128][128]; 6 matrix() {memset(mat,0,sizeof(mat));} 7 void get() { 8 for(int i = 1;i <= n;++i) 9 for(int j = 1;j <= n+1;++j) 10 scanf("%lf",&mat[i][j]); 11 return; 12 } 13 } rix; 14 void gate() { 15 for(int i = 1;i <= n;++i) { 16 int maxn = i; 17 for(int j = i+1;j <= n;++j) 18 if(fabs(rix.mat[i][j]) > fabs(rix.mat[maxn][i])) 19 maxn = j; 20 for(int j = 1;j <= n+1;++j) 21 swap(rix.mat[i][j],rix.mat[maxn][j]); 22 if(!rix.mat[i][i]) { 23 printf("No Solution"); 24 return; 25 } 26 for(int j = 1;j <= n;++j) 27 if(i != j) { 28 double temp = rix.mat[j][i]/rix.mat[i][i]; 29 for(int k = i+1;k <= n+1;++k) 30 rix.mat[j][k] -= rix.mat[i][k]*temp; 31 } 32 } 33 for(int i = 1;i <= n;++i) 34 printf("%.2lf\n",rix.mat[i][n+1]/rix.mat[i][i]); 35 return; 36 } 37 int main() { 38 scanf("%d",&n); 39 rix.get(); 40 gate(); 41 return 0; 42 }