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 := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

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;
		cout << D << " " << D1 << " " << D2 << endl;
		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 );
		cout << isX << " " << isY << endl;
		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;
		}

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

	return 0;
}

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

// ax + by = c
// dx + ey = f
// det(A) = ae-bd
// A^(-1) = 1/det(A)* ((e,-b),(-d,a))
// x = 1/det(A) *(ce-bf)
// y =			*(-cd+af)

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    double a,b,c,d,e,f,g,h;
    while(cin>>a>>b>>c>>d>>e>>f){
            h=0;g=0;
    h=(d*c-a*f)/(b*d-a*e);
    g=(c-b*h)/a;
    printf("%.3lf %.3lf\n",g,h);
    }
    return 0;

}

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;
		}
		p[0] = x / 1;
		q[0] = y / 1;
		b = x * 10;
		c = y * 10;
		for (int i = 1;i<4;i++){
			p[i] = (b*10) % 10;
			q[i] = (c*10) % 10;
			x = x * 10;
			y = y * 10;
			b = x;
			c = y;
		}
		cout << p[0] << "." << p[1] << p[2] << p[3] << " " << q[0] << "." << q[1] << q[2] << q[3] << endl;
	}
	return 0;
}

C++: #include<iostream>
int main(){for(float a,b,c,d,e,f,x,y;;){std::cin>>a>>b>>c>>d>>e>>f;if(std::cin.eof())break;d&&b*d-a*e?(x=f/d-e*(c*d-a*f)/(b*d-a*e)/d,y=b?c/b-a*x/b:f/e-d*x/e):(y=(c*d-a*f)/(b*d-a*e),x=a?c/a-b*y/a:f/d-e*y/d);printf("%.3f %.3f\n",x,y);}}

C++: #include<iostream>
int main() {
  int a[6];
  for(int i=0;i<=5;i++) {
    scanf("%d",&a[i]);
  }
  char x,y;
  x=(a[2]*a[4]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3]);
  y=(a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4]);
  printf("%d"" ""%d",x,y);
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
  double a, b, c, d, e, f, x, y;
  while (cin >> a >> b >> c >> d >> e >> f) {
    x = (b * f - e * c) / (b * d - a * e);
    y = (c - a * x) / b;
    if (!x) x = 0;
    if (!y) y = 0;
    cout << x << ' ' << y << '\n';
  }
  return 0;
}

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

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

	cout << x << " " << y << "\n";

}

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

int main(){

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

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

C++: #include <stdio.h>
#include <math.h>
int main(void){
    float a,b,c,d,s,t;
    while(~scanf("%f%f%f%f%f%f",&a,&b,&s,&c,&d,&t)){
        printf("%.3f %.3f\n",floor((s*d-b*t)/(a*d-b*c)*1000+0.5)/1000,(a*t-s*c)/(a*d-b*c));
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<25)     //33554432
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
  double a, b, c, d, e, f;
  while(cin>>a>>b>>c>>d>>e>>f) {
    cout << fixed << setprecision(3) << (c*e-b*f)/(a*e-b*d) << " " << (c*d-a*f)/(b*d-a*e) << endl;
  }

  return 0;
}

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

class Calc{
    public:
    double A[N][N+1];
    int i, j, k;
    double tmp;
    void calcSi();
    void printSi();
};

void Calc::calcSi(){
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            tmp = A[j][i] / A[i][i];
            for(k=i+1; k<=N; k++)
                A[j][k] -= A[i][k] * tmp;
        }
    }

    for(i=N-1; i>=0; i--){
        tmp = A[i][N];
        for(j=i+1;j<N;j++)
            tmp -= A[i][j] * A[j][N];
        A[i][N] = tmp / A[i][i];
    }
}

void Calc::printSi(){
    for(i=0;i<N;i++){
        printf("%.3f",A[i][N]);
        if(i != N) {
            cout << " ";
        }
    }
    cout << endl;
}

int main(void){
    Calc c;
    while(cin >> c.A[0][0] >> c.A[0][1] >> c.A[0][2] >> c.A[1][0] >> c.A[1][1] >> c.A[1][2]){
        c.calcSi();
        c.printSi();
    }
    return 0;
}

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

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

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

C++: #include <iostream>
using namespace std;
int main() {
	int i;
	double a[2], b[2], c[2], x, y;
	cin >> a[0] >> b[0] >> c[0] >> a[1] >> b[1] >> c[1];
	if (a[0] == 0) {
		y = c[0] / b[0];
		x = (c[1] - b[1] * y) / a[1];
	}
	else if (b[0] == 0) {
		x = c[0] / a[0];
		y = (c[1] - a[1] * x) / b[1];
	}
	else if (a[1] == 0) {
		y = c[1] / b[1];
		x = (c[0] - b[0] * y) / a[0];
	}
	else if (b[1] == 0) {
		x = c[1] / a[1];
		y = (c[0] - a[0] * x) / b[0];
	}
	else {
		x = (c[1] - c[0] * b[1] / b[0]) / (a[1] - a[0] * b[1] / b[0]);
		y = (c[0] - a[0] * x) / b[0];
	}
	x = x * pow(10,3);
	x = round(x);
	x = x * pow(10, -3);
	y = y * pow(10, 3);
	y = round(y);
	y = y * pow(10, -3);
	cout << x << endl << y << endl;
	return 0;
}