Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.ParseFloat(s[0], 64)
		b, _ := strconv.ParseFloat(s[1], 64)
		c, _ := strconv.ParseFloat(s[2], 64)
		d, _ := strconv.ParseFloat(s[3], 64)
		e, _ := strconv.ParseFloat(s[4], 64)
		f, _ := strconv.ParseFloat(s[5], 64)
		x := ((b * f) - (c * e)) / ((b * d) - (a * e))
		y := ((a * f) - (c * d)) / ((a * e) - (b * d))
		if x == 0 {
			fmt.Printf("0.000 %.3f\n", y)
		} else if y == 0 {
			fmt.Printf("%.3f 0.000\n", x)
		} else {
			fmt.Printf("%.3f %.3f\n", x, y)
		}
	}
}

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(15) << res[0] << " " << fixed << setprecision(15) << res[1] << endl;
  }
}

C++: //#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
using namespace std;
#define j bai;
int main() {
	double a, b, c, d, e, y, x, f, bai;
	bool bo = false;
	while (cin >> a >> b >> c >> d >> e >> f) {
		if (a ==0 || b ==0) {
			if (a) {
				y = c / b;
				x = f / d - e*y;
			}
			else if (b) {
				x = a / c;
				y = f / e - d*x;
			}
			bo = true;
		}
		else if (d == 0 || e == 0) {
			if (d) {
				y = f / e;
				x = c / a - d*y;
			}
			else if (e) {
				x = f / d;
				y = f / e - d*x;
			}
			bo = true;
		}
		
		else if (a < d) {
			bai = d / a;
			a *= j;
			b *= j;
			c *= j;
		}
		else {
			bai = a / d;
			d *= j;
			e *= j;
			f *= j;
		}
		if (((a > 0 && d < 0) || (a < 0 && d>0)) && bo==false) {
			y = (c + f) / (b + e);
			x = (c - b*y) / a;
		}
		else if (bo == false) {
			y = (c - f) / (b - e);
			x = (c - b*y) / a;
		}
		if (x == -0.000) {
			x = abs(x);
		}
		if (y == -0.000) {
			y = abs(y);
		}
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

using namespace std;

/*
aX+bY=c
dX+eY=f
*/

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (f - e*c/b) / (d - e*c/b);
	double y = (c - a*x) / b;
	printf("%4f %4f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	return 0;
}

C++: #include<stdio.h>
#include<algorithm>
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){
			y = (c*d-f*a)/(b*d-a*e);
			x = (c-b*y)/a;
			printf("%.3f %.3f\n",x ,y);
		 }
		 return 0;
}

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

int main(){
  int n[6];
 
  while(cin>>n[0]>>n[1]>>n[2]>>n[3]>>n[4]>>n[5]){

  float a,b,c;
  float x,y;
  a = (float)n[0]/(float)n[3];
  b = -n[4]*a;
  c = -n[5]*a;
  
  a = n[1] + b;
  b = n[2] + c;
  y = b/a;
  x = (n[2]-n[1]*y)/n[0];

  cout << x << ' ' << y << endl;
}
  return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <iostream>
#include <limits>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ld long double
ld a, b, c, d, e, f, x, y;
ld shish(ld a)
{
	a *= 1000;
	a += 0.501;
	a = (ld)((int)a);
	a /= 1000;
	cout << a << endl;
	return a;
}
int main() {
	while (cin >> a >> b >> c >> d >> e >> f) {
		y = (a*f - c*d) / (ld)(a*e - b*d);
		x = (c*e - f*b) / (ld)(a*e - b*d);
		x = shish(x);
		y = shish(y);
		cout << fixed;
		cout << setprecision(std::numeric_limits<double >::max_digits10) << x;
		cout << " ";
		cout << fixed;
		cout << setprecision(std::numeric_limits<double >::max_digits10) << y;
		cout << endl;
	}
}

C++: #include <cstdio>

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

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

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

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

	return 0;
}

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

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