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

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

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

using namespace std;
double round(double value);

int main(){
  double a,b,c,d,e,f;
  vector<double> al,bl,cl,dl,el,fl;
  double x,y,n,m;

  while(cin >> a >> b >> c >> d >> e >> f){
    al.push_back(a);
    bl.push_back(b);
    cl.push_back(c);
    dl.push_back(d);
    el.push_back(e);
    fl.push_back(f);
  }

  for(int i=0; i<al.size(); i++){
    n = bl[i]/el[i];
    m = al[i]/dl[i];
    x = (cl[i]-n*fl[i])/(al[i]-n*dl[i]); 
    y = (cl[i]-m*fl[i])/(bl[i]-m*el[i]);
    cout << setprecision(3) << fixed << round(x) << " " << round(y) << endl;
  }

  return 0;
}


double round(double value){
  return floor(value*1000 + 0.5)/1000;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

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

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

using namespace std;

template<typename T> class Vector {
protected:
  vector<T> val;

public:
  Vector(int n) : val(n, 0) {}

  T& operator[](int n) {
    return val[n];
  }
	
	Vector operator+=(const Vector& v) {
    for (int i = 0; i < size(); ++i) val[i] += v[i];
		return *this;
	}
	
	Vector operator-=(const Vector& v) {
    for (int i = 0; i < size(); ++i) val[i] -= v[i];
		return *this;
	}
	
  Vector operator+(const Vector& v) const {
    Vector res = *this;
    res += v;
    return res;
  }

  Vector operator-(const Vector& v) const {
    Vector res = *this;
    res -= v;
    return res;
  }

  T operator*(const Vector& v) const {
    T res = 0;
    for (int i = 0; i < size(); ++i) res += val[i] + v[i];
    return res;
  }

  int size() const {
    return val.size();
  }
};

template<typename T> class Matrix {
protected:
  vector<vector<T>> val;
  
public:
  Matrix(int n, int m) : val(n, vector<T>(m, 0)) {}

  vector<T>& operator[](int n) {
    return val[n];
  }
	
	Matrix operator+=(const Matrix& m) {
    for (int i = 0; i < (int)val.size(); ++i) val[i] += m[i];
		return *this;
	}
	
	Matrix operator-=(const Matrix& m) {
    for (int i = 0; i < (int)val.size(); ++i) val[i] -= m[i];
		return *this;
	}

  Matrix operator*=(Matrix m) {
    return *this = *this * m;
  }

  Matrix operator+(const Matrix& m) const {
    Matrix res = *this;
    res += m;
    return res;
  }

  Matrix operator-(const Matrix& m) const {
    Matrix res = *this;
    res -= m;
    return res;
  }

  Matrix operator*(Matrix m) {
    Matrix res(size(), m[0].size());
    for (int i = 0; i < size(); ++i) {
      for (int j = 0; j < m.size(); ++j) {
        for (int k = 0; k < m[0].size(); ++k) {
          res[i][k] += val[i][j] * m[j][k]; 
        }
      }
    }
    return res;
  }
  
  Vector<T> operator*(Vector<T>& v) {
    Vector<T> res(size());
    for (int i = 0; i < size(); ++i) {
      for (int j = 0; j < v.size(); ++j) res[i] += val[i][j] * v[j];
    }
    return res;
  }

  int size() const {
    return val.size();
  }
};

template<typename T> class SquareMatrix : public Matrix<T> {
public:
  SquareMatrix(int n) : Matrix<T>(n, n) {}

  SquareMatrix(const Matrix<T>& m) : Matrix<T>(m) {}

	SquareMatrix operator/=(SquareMatrix& m) {
		return *this *= m.inverse();
	}

  SquareMatrix operator/(SquareMatrix m) {
    return *this * m.inverse();
  }

  SquareMatrix identity() const {
    SquareMatrix res(this->size());
    for (int i = 0; i < this->size(); ++i) res[i][i] = 1;
    return res;
  }

  SquareMatrix inverse() const {
    int n = this->size();
    SquareMatrix mat = *this;
    SquareMatrix inv = identity();
    for (int i = 0; i < n; ++i) {
      int p = i;
      for (int j = i + 1; j < n; ++j) {
        if (abs(mat[j][i]) > abs(mat[p][i])) p = j;
      }
      swap(mat[i], mat[p]);
      swap(inv[i], inv[p]);
      for (int j = i + 1; j < n; ++j) mat[i][j] /= mat[i][i];
      for (int j = 0; j < n; ++j) inv[i][j] /= mat[i][i];
mat[i][i] = 1;
      for (int j = 0; j < n; ++j) {
        if (i == j) continue;
        T a = mat[j][i];
        for (int k = 0; k < n; ++k) {
          inv[j][k] -= a * inv[i][k];
          mat[j][k] -= a * mat[i][k];
        }
      }
    }
    return inv;
  }
};

int main() {
  SquareMatrix<double> m(2);
  Vector<double> v(2);
  while (cin >> m[0][0] >> m[0][1] >> v[0] >> m[1][0] >> m[1][1] >> v[1]) {
    auto res = m.inverse() * v;
    cout << fixed << setprecision(3) << res[0] << " " << fixed << setprecision(3) << res[1] << endl;
  }
}

C++: #include <stdio.h>

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-6

int main(){
	int a,b,c,d,e,f;
	while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
		int p = c*e - b*f;
		int q = a*e - b*d;
		double x,y;
		
		//printf("p:%d  , q:%d\n",p,q);
		if( q!=0 ){
			x = (double)abs(p) / (double)abs(q);
			if( p<0&&q>0 || p>0&&q<0 ) x *= -1;
		}else{
			puts("???");
		}
		if( e!=0 ){
			y = (double)( f - d*x ) / (double)e + EPS;
		}else{
			puts("???????");
		}
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

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