Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.ParseFloat(s[0], 64)
		b, _ := strconv.ParseFloat(s[1], 64)
		c, _ := strconv.ParseFloat(s[2], 64)
		d, _ := strconv.ParseFloat(s[3], 64)
		e, _ := strconv.ParseFloat(s[4], 64)
		f, _ := strconv.ParseFloat(s[5], 64)
		x := ((b * f) - (c * e)) / ((b * d) - (a * e))
		y := ((a * f) - (c * d)) / ((a * e) - (b * d))
		if x == 0 {
			fmt.Printf("0.000 %.3f\n", y)
		} else if y == 0 {
			fmt.Printf("%.3f 0.000\n", x)
		} else {
			fmt.Printf("%.3f %.3f\n", x, y)
		}
	}
}

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

struct vector2{
	float x, y;
	vector2() : x(0), y(0){}
	vector2(float x, float y) : x(x), y(y){}
};

struct sim_elem{
	float a, b, c, d, e, f;
	sim_elem() :a(0), b(0), c(0), d(0), e(0), f(0){}
	sim_elem(float a, float b, float c, float d, float e, float f) :a(0), b(0), c(0), d(0), e(0), f(0){}
};

//	a / d * d
//	ey - by = f - c
//	y / y = (f - c) / y

// ax = -by + c
// ax / a = -(by + c) / a

vector2 sim_equ(sim_elem elem){

	float dx = elem.a / elem.d * elem.d;
	float ey = elem.a / elem.d * elem.e;
	float f = elem.a / elem.d * elem.f;
	if (elem.d == 0){ dx = 0, ey = 0, f = 0; }

	float y = ey - elem.b;
	float yr = f - elem.c;
	if (y != 0)y = yr / y;

	float ax = -elem.b * y + elem.c;
	float x = ax / elem.a;
	if (elem.a == 0)x = 0;

	return vector2(x, y);
}

//	sprintf
float placement4(float val){
	char ret[128];
	sprintf(ret, "%.3f", val);
	return (float)atof(ret);
}

int main(){

	sim_elem elem;
	while (1){
		cin >> elem.a >> elem.b >> elem.c >> elem.d >> elem.e >> elem.f;
		if (cin.eof())break;
		vector2 ret;
		ret = sim_equ(elem);
		printf("%.3f %.3f\n", placement4(ret.x) ,placement4(ret.y) );
	}

	return 0;
}

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

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

}

C++: #include <stdio.h>

int main(void)
{
	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){
		if(e*a > b*d){		
			x = (e*c - b*f) / (e*a - b*d);
			y = (d*c - a*f) / (e*a - b*d) * (-1);
		}
		else{
			x = (e*c - b*f) / (b*d - e*a) * (-1);
			y = (d*c - a*f) / (b*d - e*a);
		}
		x += 0.0005;
		y += 0.0005;

		printf("%.3f %.3f\n", x, y);
	}
	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;
    A =floor((A+0.0005)*1000)/1000;//小数第4位を四捨五入
    B =floor((B+0.0005)*1000)/1000;
    if(A ==0)
      A =0;
    if(B ==0)
      B =0;
    printf("%.3f %.3f\n",B,A);
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f){
		double x = double(c*e-f*b)/double(a*e-d*b);
		double y = double(c*d-f*a)/double(b*d-a*e);
		if(abs(x)<0.00001) x = 0.0;
		if(abs(y)<0.00001) y = 0.0;
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    double a,b,c,d,e,f;
    
    while(cin>>a){
        
        cin>>b>>c>>d>>e>>f;
        double h=a*e-b*d;
        double xx=(c*e-f*b);
        double yy=(a*f-c*d);
        
        double x=xx/h;
        double y=yy/h;
        printf("%.3f %.3f \n",x,y);
       
    }
return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
using namespace std;

int main(){

    double a,b,c,d,e,f,y,x,bb,cc,dd,ee,ff;
    while(cin>>a>>b>>c>>d>>e>>f){
        bb=b/a;
        cc=c/a;
        ee=e/d;
        ff=f/d;
        y=(cc-ff)/(bb-ee);
        x=(c-b*y)/a;
        //y=123.45678;
        y=round(1000*y);
        y=(int)y;
        y=y/1000;
        
        x=round(1000*x);
        x=(int)x;
        x=x/1000;
        cout<<fixed<<setprecision( 3 )<<x<<" "<<y<<endl;
        //printf("%f %f\n",x,y);
    }
    return 0;
}

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

int main(){
	vector<vector<double> > mat(2, vector<double>(3));
	while(cin>>mat[0][0]>>mat[0][1]>>mat[0][2]>>mat[1][0]>>mat[1][1]>>mat[1][2]){
		if(mat[1][0]!=0) swap(mat[0], mat[1]);
		for(int i=0; i<2; i++){
			if(mat[i][0]!=0){
				for(int j=2; j>=0; j--){
					mat[i][j] /= mat[i][0];
				}
			}
		}
		if(mat[1][0]!=0){
			for(int i=0; i<3; i++){
				mat[1][i] -= mat[0][i];
			}
		}
		mat[1][2] /= mat[1][1];
		mat[0][2] -= mat[1][2]*mat[0][1];
		
		cout << fixed;
		cout << setprecision(3);
		cout << mat[0][2] << " " << mat[1][2] << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int a,b,c,d,e,f;
    double X[6] = {};
    
    while( cin >> X[0]) {
    	for(int i=1;i<6;i++) 
    	cin >> X[i];
   
    double y = ( X[2] * X[3] - X[0] * X[5]) / ( X[1] * X[3] - X[0] * X[4] );

    if( X[0] !=0 )
    cout << fixed << setprecision(3) << (X[2] - X[1] * y) / X[0] << " " << y << "\n";
    
    else
    cout << fixed << setprecision(3) << (X[5] - X[4] * y) / X[3] << " " << y << "\n";
}
	return 0;
}

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

using namespace std;

double EPS = 1e-4;

int gcd(int a, int b) { return b != 0 ? gcd(b, a%b) : a; }

int main() {
	double a, b, c, d, e, f;
	
	while (cin >> a >> b >> c >> d >> e >> f) {
		double x, y;
		
		int div1 = gcd(a, b), div2 = gcd(b, d);
		int div = gcd(div1, div2);
		a /= div; b /= div; c /= div;
		
		div1 = gcd(d, e); div2 = gcd(e, f);
		div = gcd(div1, div2);
		d /= div; e /= div; f /= div;
		
		y = (c - a*f/d)/(b - a*e/d);
		if (fabs(y) < -EPS) y = 0.0;
		
		x = (c - b*y)/a;
		if (fabs(x) < EPS) x = 0.0;
		
		printf("%.3lf %.3lf\n", x, y);
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>

using namespace std;

class cEquation
{
public:
	string calc(vector<double> &);
};

string cEquation::calc(vector<double> &v)
{
	double a = v[0];
	double b = v[1];
	double c = v[2];
	double d = v[3];
	double e = v[4];
	double f = v[5];
	double x = (c*e - b*f) / (a*e - b*d);
	if (x == -0) x = 0;
	double y = (a*f - c*d) / (a*e - b*d);
	if (y == -0) y = 0;
	ostringstream oss;
	oss << fixed << setprecision(3) << x << " " << y;

	return string(oss.str());
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cEquation ct;
	vector<double> vd(6);

	for (;;)
	{
		cin >> vd[0] >> vd[1] >> vd[2] >> vd[3] >> vd[4] >> vd[5];
		if (cin.fail()) break;
		cout << ct.calc(vd) << endl;
	}

	return 0;
}

C++: #include<stdio.h>

void printFunc(int a,int b,int c,int d,int e,int f);

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

  scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
  printFunc(a,b,c,d,e,f);
  scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
  printFunc(a,b,c,d,e,f);

  return 0;
}

void printFunc(int a,int b,int c,int d,int e,int f){
  float ansX,ansY;
  if(b == 0 || e == 0){
    ansY = 0;
  }
  else{
    ansY = (float)(c*d - f*a)/(float)(b*d - e*a);
  }

  if(a == 0 || d == 0){
    ansX = 0;
  }
  else{
    ansX = (float)(c*e - f*b)/(float)(a*e - d*b);
  }

  if(ansX < 0.001f){
    ansX = 0.0f;
  }
  if(ansY < 0.001f){
    ansY = 0.0f;
  }

  printf("%.3f %.3f\n",ansX,ansY);
}