Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

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<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int a, b, c, d, e, f;

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

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

// ax + by = e1
// cx + dy = e2
auto solve (double a , double b , double e1 , double c , double d , double e2) -> std::pair <double , double>
{
    auto delta = a * d - b * c;
    return std::make_pair ((d * e1 - b * e2) / delta , (a * e2 - c * e1) / delta);
}

auto show (double v) -> std::string
{
    char s [100];
    if (-0.0005 < v && v < 0.0005)
    {
        return "0.000";
    }
    std::sprintf (s , "%.3f" , v);
    return s;
}

auto main () -> int
{
    double a , b , c , d , e , f;
    while (std::cin >> a >> b >> c >> d >> e >> f)
    {
        auto xy = solve (a , b , c , d , e , f);
        std::cout << show (xy.first) << ' ' << show (xy.second) << std::endl;
    }
}

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

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

	return 0;
}

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

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

	while(1){
		getline( cin, str );
		if( str.size()==0 ){
			break;
		}
		sscanf( str.c_str(), "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f );

		double D  = a*e-b*d;
		double D1 = c*e-f*b;
		double D2 = a*f-d*c;
		x = D1 / D;
		y = D2 / D;

		bool isX = ( (c-a*x)/b == (f-d*x)/e );
		bool isY = ( (c-b*y)/a == (f-e*y)/d );
		if( !isX && isY ){
			x = 0.0;
			y = c/b;
		}else if( isX && !isY ){
			y = 0.0;
			x = c/a;
		}else if( !isX && !isY ){
			x = y = 0.0;
		}

		if( x == -0.000 )	x = 0.000;
		if( y == -0.000 )	y = 0.000;

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

	return 0;
}

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

int main(){
  double a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,f2,a3,b3,c3,d3,e3,f3,x,y;

  for(;;){
    cin>>a1>>b1>>c1>>d1>>e1>>f1;

    a2=a1*d1;
    b2=b1*d1;
    c2=c1*d1;

    d2=a1*d1;
    e2=a1*e1;
    f2=a1*f1;

    y=(c2-f2)/(b2-e2);

    a3=a1*e1;
    b3=b1*e1;
    c3=c1*e1;

    d3=b1*d1;
    e3=b1*e1;
    f3=b1*f1;

    x=(c3-f3)/(a3-d3);

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

}

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

int main(){
	int a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		int d1[3]={a,b,c};
		int d2[3]={d,e,f};
		double anx=(c*e-f*b)/(a*e-d*b);
		double any=(c*d-f*a)/(b*d-e*a);
		printf("%.3f ",anx);
		printf("%.3f\n",any);
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

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

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

using namespace std;

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

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

C++: //
//  main.cpp
//  Sample
//
//  Created by h3037183 on 2017/07/31.
//  Copyright ?? 2017??´ ?°????. All rights reserved.
//

#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    double a,b,c,d,e,f,x,y;
    for(;;){
    cin>>a>>b>>c>>d>>e>>f;
    x=(c*e-b*f)/(a*e-b*d);
    y=(c*d-a*f)/(b*d-a*e);
    cout<<x<<" "<<y<<endl;
    }
    return 0;
}

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

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

C++: 
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	int a, b, c, d, e, f;
	double by, ey, x, y, cc, ff;
	while (cin >> a >> b >> c >> d >> e >> f) {
		by = b*d;
		cc = c*d;
		ey = e*a;
		ff = f*a;
		y = (ff - cc) / (ey - by);
		x = (c - b*y) / a;
		int xx = x * 10000, yy = y * 10000;
		if (xx % 10 >= 5) {
			x += 0.001;
		}
		if (yy % 10 >= 5) {
			y += 0.001;
		}
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  double a,b,c,d,e,f;
  while(cin >> a >> b >> c >> d >> e >>f){
    double delta = a*e - d*b;
    double x = (1/delta)*(e*c+(-b)*f);
    double y = (1/delta)*((-d)*c+a*f);
    //cout << x << " " <<y << endl;
    printf("%4.3f %4.3f\n",x,y);
  }
}

C++: #include <algorithm>
#include <string.h>
#include <stdio.h>

int main()
{
	const double EPS = 1.0e-10;
	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){
		x = (e * c - b * f) / (a * e - b * d);
		y = (a * f - d * c) / (a * e - b * d);
		if(-0.0005 < x && x < 0.0+EPS) x = 0.0;
        if(-0.0005 < y && y < 0.0+EPS) y = 0.0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
  double a, b, c, d, e, f;
  while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
    double ee = e / b, dd = d / a;
    double ax = a * ee, cx = c * ee;
    printf("%.3f ", (cx - f) / (ax - d) == -0 ? 0 : (cx - f) / (ax - d));
    b *= dd, c *= dd;
    printf("%.3f\n", (c - f) / (b - e) == -0 ? 0 : (c - f) / (b - e));
  }
  return 0;
}