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 <iomanip>
using namespace std;

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

  while(cin >> a >> b >> c >> d >> e >> f) {
    double x, y;
    double tmp_b = b, tmp_c = c;
    b *= d;
    c *= d;
    e *= a;
    f *= a;

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

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

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

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 = (c*e - b*f)/(a*e - b*d);
    y = (a*f - c*d)/(a*e - b*d);
    printf("%.3lf %.3lf\n",x,y);
  }
return 0;
}

C++: const int tt = 10000;

#include<iostream>
#include<string>
#include<sstream>
using namespace std;

string toStr(int n);
string intToString(int n);

int main() {
  int a, b, c, d, e, f;
  
  while(cin >> a >> b >> c >> d >> e >> f) {
    c = c * tt;
    f = f * tt;

    int det = a * e - b * d;

    int x = ( e * c - b * f) / det;
    int y = (-d * c + a * f) / det;
    cout << x << y << endl;

    cout << toStr(x) << " " << toStr(y) << endl;
  }
}

string toStr(int n) {
  string pm, val;
  
  if (n < 0) {
    pm = "-";
    n = -n;
  } else {
    pm = "";
  }

  int ipart = n / tt;
  int fpart = (n - ipart * tt) + tt + 5;

  val = pm + intToString(ipart) + "." + intToString(fpart).substr(1, 3);
  return val;
}

string intToString(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}

C++: #include<iostream>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;

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

return 0;
}

C++: /*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
 */
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>

#define N 2
#define L N*(N+1)

using namespace	std;

int
main()
{
	string line;
	while (getline(cin, line)) {
		istringstream iss(line);
		vector <float> coef(L);
		for (int i = 0; i < L; i++)
			iss >> coef[i];
		float pivot, mul;
		for (int i = 0; i < N; i++) {
			pivot = coef[i * (N + 1) + i];
			for (int j = 0; j < N + 1; j++) {
				coef[i * (N + 1) + j] = (1 / pivot) * coef[i * (N + 1) + j];
			}
			for (int k = i + 1; k < N; k++) {
				mul = coef[k * (N + 1) + i];
				for (int l = i; l < N + 1; l++) {
					coef[k * (N + 1) + l] = coef[k * (N + 1) + l] - mul * coef[i * (N + 1) + l];
				}
			}
		}
		for (int i = N - 1; i > 0; i--) {
			for (int k = i - 1; k >= 0; k--) {
				mul = coef[k * (N + 1) + i];
				for (int l = i; l < N + 1; l++) {
					coef[k * (N + 1) + l] = coef[k * (N + 1) + l] - mul * coef[i * (N + 1) + l];
				}
			}
		}
		for (int i = 0; i < N; i++) {
			if (i > 0) cout << ' ';
			cout << fixed << setprecision(3) << coef[i * (N + 1) + N];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))

ll DET(ll a, ll b, ll c, ll d) {
  return a * d - b * c;
}

int main(void) {
  ll a,b,c,d,e,f;
  while (scanf("%lld%lld%lld%lld%lld%lld", &a, &b, &c, &d, &e, &f) == 6) {
    ll det = DET(a,b,d,e);
    ll det1 = DET(c,b,f,e);
    ll det2 = DET(a,c,d,f);
    double x = 1.0 * det1 / det;
    double y = 1.0 * det2 / det;
    printf("%.4lf %.4lf\n", x, y);
  }
  return 0;
}

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

#define REP(i, a) for(int i=0;i<(int)a;++i)
using namespace std;

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

int main() {
    solver();
    return 0;
}

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

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

void OutputSolution(int a, int b, int c, int d, int e, int f)
{
    double x, y;
	if(b == 0){
		x = c / a;
		y = (f-d*x) / e;
	}else{
		int B = b;
		a *= e;
		b *= e;
		c *= e;
		d *= B;
		e *= B;
		f *= B;
		x = (c-f) / (a-d);
		y = (c-a*x) / b;
	}
	cout << fixed << setprecision(3) << x << ' ' << y << endl;
}

int main()
{
	while(true){
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()) break;
		OutputSolution(a, b, c, d, e, f);
	}
	return 0;
}

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

int main() {
  double a[2][2];
  double a_inv[2][2];
  double det;
  double b[2];
  double x[2];
  int tmp;
  while (1) {
    cin >> a[0][0] >> a[0][1] >> b[0];
    cin >> a[1][0] >> a[1][1] >> b[1];
    if (cin.eof()) break;

    det = a[0][0]*a[1][1] - a[0][1]*a[1][0];
    a_inv[0][0] = a[1][1]/det;
    a_inv[0][1] = -a[0][1]/det;
    a_inv[1][0] = -a[1][0]/det;
    a_inv[1][1] = a[0][0]/det;
    for (int i=0; i<2; i++) {
      x[i] = 0.0;
      for (int j=0; j<2; j++) {
        x[i] += a_inv[i][j]*b[j];
      }
      tmp = round(x[i]*1000);
      if (!tmp) x[i] = 0.0;
    }
    cout.setf(ios::fixed);
    cout.precision(3);
    cout << x[0] << " " << x[1] << endl;
  }
  return 0;
}