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 <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
 
 
int main() {
    double a, b, c, d, e, f;
     
    while(cin >> a >> b >> c >> d >> e >> f){
        double x = (e*c-b*f)/(a*e-b*d);
        double y = (-c*d+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>
#include <cmath>
using namespace std;

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

C++: #include <iostream>
#include <stdio.h>
using namespace std;
 
int main(){
    double a,b,c,d,e,f,delta,kai,kait;
    while(1){
    if( scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) == EOF) break;
    delta=a*d-b*c;
    kai=(d*e-b*f)/delta;
    kait=(a*f-e*c)/delta;
    printf("%.3f %.3f\n",kai,kait);
    }
 
    return 0;
}

C++: package task0004;

import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			double a = sc.nextInt();
			double b = sc.nextInt();
			double c = sc.nextInt();
			double d = sc.nextInt();
			double e = sc.nextInt();
			double f = sc.nextInt();

			// 連立方程式の解
			double x = (b * f - c * e) / (b * d - a * e);
			double y = (c * d - a * f) / (b * d - a * e);

			if (x == 0)
				x = 0;
			if (y == 0)
				y = 0;

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

			// BigDecimal ax = new BigDecimal(x);
			// BigDecimal ay = new BigDecimal(y);
			//
			// // 小数第4位を四捨五入
			// ax = ax.setScale(3, BigDecimal.ROUND_HALF_UP);
			// ay = ay.setScale(3, BigDecimal.ROUND_HALF_UP);
			//
			// System.out.println(ax + " " + ay);
		}

		sc.close();
	}

	void run1() {
		Scanner sc = new Scanner(System.in);

		double[] a = new double[6];

		while (sc.hasNext()) {
			for (int i = 0; i < 6; i++) {
				a[i] = sc.nextDouble();
			}

			double d = a[0] * a[4] - a[1] * a[3];
			double x = (a[4] * a[2] - a[1] * a[5]) / d;
			double y = (a[0] * a[5] - a[3] * a[2]) / d;

			if (x == 0)
				x = 0;
			if (y == 0)
				y = 0;

			System.out.printf("%.3f %.3f", x, y);
		}

		sc.close();
	}

	public static void main(String[] args) {
		new Main().run1();
	}

}

C++: /*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004&lang=jp*/

#include <iostream>

using namespace std;

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

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

using namespace std;

int main (int argc, char const* argv[])
{
    double a,b,c,d,e,f;
    double x,y;
    
    while(cin >> a >> b >> c >> d >> e >> f){
        x = (c*e - b*f) / (a*e - b*d);
        y = (c - a*x)/b;
        
        x = round(x * 1000)/1000.0;
        y = round(y * 1000)/1000.0;
        
        printf("%.03lf %.03lf\n",x,y);
    }
    
    return 0;
}

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

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

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

		cout << fixed;

		cout << setprecision(3) << x << " " 
		     << setprecision(3) << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  double a,b,c,d,e,f;
  double A,B,C;
  double temp;
  int cnt;
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
    A = a;
    B = b;
    C = c;
    b /= a;
    c /= a;
    a = 1;
    e /= d;
    f /= d;
    d = 1;
    b -= e;
    c -= f;
    c /= b;
    C -= c * B;
    C /= A;
    printf("%.3f %.3f\n",C,c);
  }
  return(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <utility>
using namespace std;
typedef pair<double, double> PDD;
PDD calc(double mat[2][2], double vec[2]){
  double a = mat[0][0], b = mat[0][1], d = mat[1][0], e = mat[1][1];
  double c = vec[0], f = vec[1];
  double det = a * e - d * b;
  return make_pair((e * c - b * f) / det, (-c * d + a * f) / det);
}
int main(){
  double mat[2][2];
  double vec[2];
  while(cin >> mat[0][0] >> mat[0][1] >> vec[0] >> mat[1][0] >> mat[1][1] >> vec[1]){
    PDD res = calc(mat, vec);
    double x = (double)(round(res.first*1000))/1000.0, y = (double)(round(res.second*1000))/1000.0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

C++: #include<iostream>


using namespace std;

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

		x=(e*c-f*b)/(e*a-b*d);
		y=(d*c-f*a)/(b*d-a*e);
		printf("%.3f %.3f\n",x,y);
//		x*=1000;
//		x=x+0.5-(a<0);
//		x=int(x);
//		x/=1000;

//		y*=1000;
//		y=y+0.5-(a<0);
//		y=int(y);
//		y/=1000;
//		x=y=a=b=c=d=e=f=0;
	}
}

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

/*
ax + by = c
dx + ey = f

x = (c-by)/a
d(c-by)/a + ey = f
dc/a - dby/a + ey = f
ey - dby/a = f - dc/a
y(e-db/a) = f - dc/a
y = (f-dc/a)/(e-db/a)

aex + bey = ce
bdx + bey = bf
aex - bdx = ce - bf
x(ae - bd) = ce - bf
x = (ce - bf)/(ae - bd)
by = c - ax
y = (c - ax)/b
*/
int main()
{
    while(true){
        double a, b, c, d, e, f;
        std::cin >> a >> b >> c >> d >> e >> f;
        if(std::cin.eof()) break;
        double x, y;
        if(b){
            x = (c*e - b*f) / (a*e - b*d);
            y = (c - a*x) / b;
        }else{
            y = (f-d*c/a)/(e-d*b/a);
            x = (c-b*y)/a;
        }
        if(x == -0) x = 0;
        if(y == -0) y = 0;
        std::cout << std::fixed << std::setprecision(3);
        std::cout << x << " " << y << std::endl;
    }
    return 0;
}

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

void deal(double &x)
{
    if (fabs(x) < 1e-6) x = 0;
}

double a, b, c, d, e, f;
void solve(double &x, double &y)
{
    if (b == 0)
    {
        x = c / a;
        y = (f - d * x) / e;
    }
    else
    {
        x = (b * f - e * c) / (b * d - e * a);
        y = (c - a * x) / b;
    }
    deal(x); // !
    deal(y); // !
}

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