Go: package main

import (
        "fmt"
        "bufio"
        "os"
        "math"
)

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                if x == 0.0 {
                        x = math.Abs(x)
                }
                if y == 0.0 {
                        y = math.Abs(y)
                }
                fmt.Printf("%.3f %.3f\n", x, y)
        }
}

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




double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(){
    
	double ax, by, c, dx, ey, f;
    double x, y;
    double l, d1, d2;
        
	while(cin>> ax>> by>> c >> dx>> ey>> f){
        
        x = 0.0;
        y = 0.0;
        
        if(ax == dx){
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        else if (by == ey) {
            ax -= dx;
            x = (c-f) / ax;
            y = (f + dx*(-x)) / ey;
        }
        else{
            l = lcm(fabs(ax), fabs(dx));
            d1 = l / ax;
            d2 = l / dx;
            ax *= d1;
            by *= d1;
            c  *= d1;
            dx *= d2;
            ey *= d2;
            f  *= d2;
            
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        
        printf("%.3lf %.3lf\n", x, y);
        
        
	}
    
    
	return 0;
}

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

int round(double x){
	if(x>=0){
		return x+0.5;
	}else{
		return x-0.5;
	}
}


int main(){

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

	while(cin>>a>>b>>c>>d>>e>>f){
		x = (c*e - b*f)/(double)(a*e - b*d);
		y = (c*d - a*f)/(double)(b*d - a*e);

		int o,p;
		o = round(x*1000);
		p = round(y*1000);


		printf("%.3lf %.3lf\n",(double)o/1000,(double)p/1000);
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
  double a,b,c,d,e,f,x,y;
  while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
    x = (a*f - c*d)/(a*e - d*b);
    y = (c - b*y)/a;
    printf("%.3f %.3f",x,y);
  }
}

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

C++: module Input
	def numread()
		s = gets().split()
		p = Array.new()
		for i in 0...s.size()
			p[i] = s[i].to_i()
		end
		return p
	end
	
	module_function:numread
end

include Input

loop{
	if(STDIN.eof())
		break
	end
	w = numread()
	x = (w[2] * w[4] - w[1] * w[5]).to_f / (w[0] * w[4] - w[1] * w[3])
	y = (w[2] * w[3] - w[0] * w[5]).to_f / (w[1] * w[3] - w[0] * w[4])
	print(sprintf("%.3f %.3f\n",x,y))
}

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

int main(){
  int i;
  float x[6];
  int y1, y2, re1, re2;

  while(cin >> x[0]){
    for(i=1; i<6; i++){
      cin >> x[i];
    }

    //normalize
    x[1]/=x[0]; x[2]/=x[0]; x[0]=1;

    //subtraction
    x[4]-=x[3]*x[1]; x[5]-=x[3]*x[2]; x[3]=0;

    //normalize
    x[5]/=x[4]; x[4]=1;

    //subtraction
    x[2]-=x[1]*x[5]; x[1]=0;

    y1=(int)x[2]*10000; y2=(int)x[5]*10000;
    re1=y1%10; re2=y2%10;
    if(re1<5) y1-=re1;
    else y1+=10-re1;
    if(re2<5) y2-=re2;
    else y2+=10-re2;
    printf("%f %f\n", (float)y1/10000.0f, (float)y2/10000.0f);
  }

  return 0;
}

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

void solve_SE(double* x, double a, double b, double c, double d, double e, double f)
{
    x[0] = (c * e - f * b) / (a * e - d * b);
    x[1] = (c * d - f * a) / (b * d - e * a);
}

int main()
{
    double a, b, c, d, e, f;
    double x[2];
    while (cin >> a >> b >> c >> d >> e >> f) {
        solve_SE(&x[0], a, b, c, d, e, f);
        for (int i = 0; i < 2; i++) {
            x[i] *= 1000;
            if (x[i] > 0)
                x[i] += 0.5;
            else 
                x[i] -= 0.5;
            x[i] = (int)x[i] / 1000;
        }
        cout << fixed << setprecision(3) << x[0] << ' ' << x[1] << endl;
    }
}

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

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

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

using namespace std;

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


    while (cin >> a >> b >> c >> d >> e >> f) {
        double div = 1 / (a*e - b*d);
        double x = (e*c - b*f) * div + 0;
        double y = (a*f - d*c) * div + 0;

        x = roundf(x * 1000) / 1000.;
        y = roundf(y * 1000) / 1000.;
        printf("%.3f %.3f\n", x, y);
    }

    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<stdio.h>

using namespace std;

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

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

		double tempb = b;

		a*=e;b*=e;c*=e;
		d*=tempb;e*=tempb;f*=tempb;
		a-=d;b-=e;c-=f;

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

		if(x == -0)
			x = 0;
		if(y == -0)
			y = 0;
		x = floor((x+0.0005)*1000)/1000;
		y = floor((y+0.0005)*1000)/1000;
		printf("%0.3lf %0.3lf\n",x,y);
	}

	return 0;
}

C++: #include<stdio.h>

int main(){

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

while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
y=(c*d-a*f)/(b*d-a*e);
x=(c*e-a*f)/(a*e-b*d);

printf("%.3lf %.3lf\n",x,y);
}
return 0;
}

C++: #include <stdio.h>
double round3(double a){
	a=a*10000;
	if(int(a)%10>=5){
		a=a+10-int(a)%10;
	}else{
		a=a-int(a)%10;
	}
	a=a/10000;
	return a;

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

C++: #include<iostream>

using namespace std;



int main(){

	double a, b, c, d, e, f, x, y;
	double thousand = 1000.000;

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

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

	x = x * pow(10.0, 3.0);
	x += 0.5;
	x = (int)x;
	x = (double)x/thousand;

	y = y * pow(10.0, 3.0);
	y += 0.5;
	y = (int)y;
	y = (double)y/thousand;

	cout << x << " " << y << endl;

	return 0;
}

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

int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double w = 1.0 / (a*e - b*d);
		double x = w*(e*c - b*f);
		double y = w*(-d*c + a*f);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

int main()
{
	double a, b, c, d, e, f;
	while(std::cin >> a >> b >> c >> d >> e >> f) {
	double A = e;
	double B = - b;
	double D = - d;
	double E = a;
	double det = a * e - b * d;
	double x = (A * c + B * f) / det;
	double y = (D * c + E * f) / det;
		if ( -0.0005 < x && x <= 0 ) {
			x = - x;
				}
				if ( -0.0005 < y && y <= 0 ) {
			y = - y;
				}
		
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}
	return 0;
}