Go: package main

import "fmt"

func main() {

	for {
		var a, b, c, d, e, f float64
		var x, y float64
		i, _ := fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if i != 6 {
			return
		}

		// x = ((e * c) - (b * f)) / ((a * e) - (b * d))
		y = ((a * f) - (d * c)) / ((a * e) - (b * d))
		x = (c - b*y) / a

		fmt.Printf("%.3f %.3f\n", x, y)
	}
}

C++: #include <iostream>
#include <vector>
#include <map>
 
using namespace std;
 
int main()
{
  int a,b,c,d,e,f;
  double A[2][2];
  double B[2];
  double inv_A[2][2];
  while(~scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)){
    int det = a*e-b*d;
    A[0][0]=a; A[0][1] = b;
    A[1][0]=d; A[1][1] = e;
    B[0] = c;
    B[1] = f; 
 
    inv_A[0][0]=A[1][1]; inv_A[0][1]=-A[0][1];
    inv_A[1][0]=-A[1][0]; inv_A[1][1]=A[0][0];
 
    double res[2];
    res[0]=0;
    res[1]=0;
 
 
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
	res[j]+=1.0/(double)det *inv_A[j][k]*B[k];
      }
    }
 
    printf("%.3f %.3f\n",res[0],res[1]);
  }
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	double x[50];
	double y[50];
	double a, b, c, d, e, f;
	int i = 0;
	do
	{
		cin >> a >> b >> c >> d >> e >> f;
		double sum_d = (a*e - b * d);
		y[i] = (a*f - c * d) / sum_d;
		x[i] = (c * e - b * f) / sum_d;
		++i;
	} while (cin.get() != EOF);
	--i;
	for (int j = 0; j <= i; ++j)
	{
		if ((x[j] - 0) < 0.0001 && (x[j] - 0) > -0.0001)
		{
			x[j] = 0;
		}
		else if ((y[j] - 0) < 0.0001&& (y[j] - 0) > -0.0001)
		{
			y[j] = 0;
		}
		cout << fixed << setprecision(3) << x[j] << " " << y[j]<<endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.se2", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		// ax + by = c
		// dx + ey = f
		double a, b, c, d, e, f;
		stringstream ss(str);
		ss >> a >> b >> c >> d >> e >> f;
		// [ a b ][x] = [c]
		// [ d e ][y]   [f]
		// [x] = [e -b][c]
		// [y]   [-d a][f]/D
		double D = a*e - b*d;
		double y = (a*f - d*c)/D;
		double x = (c - b*y)/a;

		printf("%.3f %.3f\n", x, y);

	} // end for

	return 0;
}

C++: #include<stdio.h>

int a ;
int b ;
int c ;
int d ;
int e ;
int f ;
double x ;
double y ;

int main()
{
	while ( scanf ( "%d %d %d %d %d %d" , &a , &b , &c , &d , &e , & ) == 6 ) {
		y = (c*a-f*a)/(b*a-e*a) ;
		x = ( c - b*(c*a-f*a)/(b*a-e*a) ) / a ;
		printf ( "%.3llf %.3llf\n" , x , y ) ;
	}
	return 0 ;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
double a,b,c,d,e,f;
double x,y;
while(cin >> a >> b >> c >> d >> e >> f){
  x = (double)((e*c-b*f) / (a*e-b*d));
  y = (double)((-(d*c)+a*f) / (a*e-b*d));
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3f %.3f\n",x,y);
 }
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main() {

  int a,b,c,d,e,f;

  while( cin >> a >> b >> c >> d >> e >> f ) {

    double x = 1.00;
    if ( ( c*e - f*b ) * ( a*e - d*b ) != 0 ) {
      x = x * ( c*e - f*b ) / ( a*e - d*b );
    }else {
      x = 0.00;
    }
    double y = 1.00;
    if ( ( c*d - f*a ) * ( b*d - e*a ) != 0 ) {
      y = y * ( c*d - f*a ) / ( b*d - e*a );
    }else {
      y = 0.00;
    }

    cout << fixed << setprecision(3) << x << " " << y << endl;

  }

  return 0;

}

C++: #include<iostream>
using namespace std;

int main()
{    
    
	int a,b,c,d,e,f;

	
	while(scanf(%d%d%d%d%d%d,&a,&b,&c,&d,&e,&f) )
	
	{
		double y=(double)(c*d-a*f)/(double)(b*d-a*e);
		if(a!=0)
		
		printf("%.3f %.3f\n",(c-b*y)/a,y);
		else
		printf("%.3f %.3f\n",(f-e*y)/d,y);
	}
}
  
    
    return 0;
    
    }

C++: #include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void){
	int a,b,c,d,e,f;
	a=b=c=d=e=f=0;
	double x=0.0f;
	double y=0.0f;
	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		x = (c*e-f*b)/(double)(a*e-b*d);
		y = (c*d-f*a)/(double)(b*d-e*a);
		x = (double)floor((x * 1000 + 0.5))/1000;
		y = (double)floor((y * 1000 + 0.5))/1000;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;

int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()) {
		x = (c - f*b / e) / (a - d*b / e);
		y = (c - a*x) / b;
	             printf("%.3lf %.3lf\n",x,y);	}
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main(){
	double  a, b, c, d, e, f, num[6];
	while(cin >> a >> b >> c >> d >> e >> f){
		num[0] = a;
		num[1] = b;
		num[2] = c;
		num[3] = d;
		num[4] = e;
		num[5] = f;
		b *= d;
		c *= d;
		e *= a;
		f *= a;
		b -= e;
		c -= f;
		c /= b;
		num[0] *= num[4];
		num[2] *= num[4];
		num[3] *= num[1];
		num[5] *= num[1];
		num[0] -= num[3];
		num[2] -= num[5];
		num[2] /= num[0];
		if(num[2] == -0)
			num[2] = 0;
		if(c == -0)
			c = 0;
		cout << fixed << setprecision(3) << num[2] << ' ' << c << endl;
	}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;


double a,b,c,d,e,f;
double A,B;//x,y座標
int main(){
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) !=EOF){
    B =(c*e-f*b)/(a*e-b*d);
    A = (c -b*B)/a;
    
    if(A ==0)
      A =0;
    if(B ==0)
      B =0;
    A =floor((A+0.0005)*1000)/1000;//小数第4位を四捨五入
    B =floor((B+0.0005)*1000)/1000;
    printf("%.3f %.3f\n",B,A);
  }
  return 0;
}

C++: #include <cstdio>

int main(){
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
		x = (double)(e*c-b*f)/(e*a-b*d);
		y = (double) (c-a*x)/b;
		if(0.00049>x&&x> -0.00049) x=0;
		if(0.00049>x&&x> -0.00049) y=0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){

  double a,b,c,d,e,f;

  while(cin >> a){
    cin >> b >> c >> d >> e >> f;
    
    if(c*e==f*b||a*e==d*b) printf("0.000 ");
    else printf("%.3f ",(c*e-f*b)/(a*e-d*b));
    if(c*d==f*a||b*d==e*a) printf("0.000\n");
    else printf("%.3f\n",(c*d-f*a)/(b*d-e*a));
  }

  return (0);
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>

using namespace std;

int main(){

  float a, b, c, d, e, f;
  float temp;
  float x, y;

  cin >> a >> b >> c >> d >> e >> f;

  temp = a/d;
  d = d*temp;
  e = e*temp;
  f = f*temp;
  b = b-e;
  c = c-f;
  y = c/b;
  x = (f-e*y)/d;

  cout << fixed << setprecision(3) << x << " " << y << "\n";

  return 0;
}

C++: #include <iostream>
#include <iomanip>
using namespace std;

int main(){
    
    double a,b,c,d,e,f,x,y;
    
    while(cin>>a>>b>>c>>d>>e>>f){
        
        y=(d*c-a*f)/(d*b-a*e);
        x=(e*c-b*f)/(e*a-b*d);
        
        if(x==-0)x=0;
        if(y==-0)y=0;
        cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
    }
}

C++: #include<iostream>
#include<iomanip>

using namespace std;

int main(){

double x, y, a, b, c, d, e, f;

while(cin >> a >> b >> c >> d >> e >> f){

x = (double) (c*e-f*b)/(a*e-b*d);
y = (double) (c*d-a*f)/(b*d-a*e);
if(x==0) x = 0;
if(y==0) y = 0;


cout << setiosflags(ios::fixed) << setprecision(3) << x << " " << y;
}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double k[60000]={0};
	int i=0;
	while(cin>>k[i++]);
	int n=i-1;
	for(int j=0;j<n;j+=6){
		double x=0,y=0,a=k[j],b=k[j+1],c=k[j+2],d=k[j+3],e=k[j+4],f=k[j+5];
		x=(c*e-b*f)/(-b*d+a*e);
		y=(c*d-a*f)/(b*d-a*e);
		if(x==0)x=abs(x);
		if(y==0)y=abs(y);
		x*=1000,x=round(x),x/=1000;
		y*=1000,y=round(y),y/=1000;
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}