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 <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>

#define DIM 2

typedef std::vector<double> Vec;
typedef std::vector<Vec> Mat;
typedef std::pair<Mat,Vec> Eq;

int main(void){
	using namespace std;

	list<Eq> input;

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

	cout << fixed << setprecision(3);

	while(cin >> a >> b >> c >> d >> e >> f){
		Vec m1, m2;
		m1.push_back(a);
		m1.push_back(b);
		m2.push_back(d);
		m2.push_back(e);

		Vec vec;
		vec.push_back(c);
		vec.push_back(f);

		Mat mat;
		mat.push_back(m1);
		mat.push_back(m2);

		Eq eq = make_pair(mat,vec);

		input.push_back(eq);
	}

	for(auto itr = input.begin(); itr!=input.end(); ++itr){
		auto mat = itr->first;
		auto vec = itr->second;

		Vec output(DIM);

		auto det = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
		std::transform(vec.begin(), vec.end(),vec.begin(), std::bind1st(multiplies<double>(),1.0/det));

		mat[0][1] = -mat[0][1];
		mat[1][0] = -mat[1][0];
		swap(mat[0][0],mat[1][1]);

		for (int i=0; i<DIM; i++){
			output[i] = inner_product(vec.begin(), vec.end(), mat[i].begin(), 0);
		}

		cout << output[0] << " " << output[1] << endl;
	}

}

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

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 y = (d * c - a * f) / (d * b - a * e);
		double x = (f - e * y) / d;
		if (fabs(x) < 1e-4) x = 0.0;
		printf("%.3f %.3f\n", x, y);
	}

	return 0;
}

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

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

int main(){
	float x, y;
	int a, b, c, d, e, f, p[4], q[4];
	while (true){
		cin >> a >> b >> c >> d >> e >> f;
		if (cin.eof()){
			break;
		}
		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{
			x = (c*e - b*f) / (e*a - b*d);
			y = (c - a*x) / b;
		}
		cout << x << " " << y << endl;
	}
	return 0;
}

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", (x * 1000) / 1000, (y * 1000) / 1000);
  }
  return 0;
}

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

using namespace std;

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

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

int main(){
  int i=0,j=0,k=0;
  double mix[1000][8];

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

  for(j=0;j<i;j++){
    mix[j][6] = (mix[j][4] * mix[j][2] - mix[j][1] * mix[j][5]) / ( mix[j][0] * mix[j][4] - mix[j][1] * mix[j][3]);
    mix[j][7] = (mix[j][0] * mix[j][5] - mix[j][3] * mix[j][2]) / ( mix[j][0] * mix[j][4] - mix[j][1] * mix[j][3]);
    printf("%.3f %.3f\n",mix[j][6],mix[j][7]);


  }
  return 0;
}

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

int main() {
  double a, b, c, d, e, f;
  while ((cin >> a >> b >> c >> d >> e >> f)) {
    // cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
    c /= a;
    b /= a;
    a = 1.0;
    // cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
    double tmp = d / a;
    // cout << "tmp " << tmp << endl;
    d -= a * tmp;
    e -= b * tmp;
    f -= c * tmp;
    // cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
    f /= e;
    e = 1.0;
    // cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
    tmp = b / e;
    // if (b * e >= 0) {
    b -= e * tmp;
    c -= f * tmp;
    /*} else {
      b += e * tmp;
      c += f * tmp;
      }*/
    // cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
    // cout << setprecision(4) << c << " " << setprecision(4) << f << endl;
    printf("%2.3f %2.3f\n", c, f);
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

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

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

#define N 1024


double func(double x)
{
	x *= 1000;
	x = (double)(int)(x + 0.5);
	x /= 1000;
	return x;
}

int main()
{
	char buff[N];
	
	while (NULL != fgets(buff, N, stdin))
	{
		double a, b, c, d, e, f;
		sscanf(buff, "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);
		
		double dd = a * e - b * d;
		double x = ( e * c - b * f ) / dd;
		double y = ( - d * c + a * f ) / dd;
		
//		x = func(x);
//		y = func(y);

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


}

C++: //
//  main.cpp
//  b
//
//  Created by h3037178 on 2017/07/31.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include <iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
    float a,b,c,d,e,f,x,y;
    while(cin>>a>>b>>c>>d>>e>>f){
        x=(c*e-f*b)/(a*e-b*d);
        y=(c*d-f*a)/(b*d-a*e);
        if(x<-0,0005){
            x=0,000;
        }
        if(y<-0.0005){
            y=0.000;
        }

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

C++: #include<stdio.h>

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