Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func mathRound(f float64) float64 {
	return math.Floor(f + .5)
}

func round(x float64) float64 {
	if math.Abs(x) < 0.001 {
		return 0
	}
	return mathRound(x*1000) / 1000
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		a, err := nextFloat64()
		if err != nil {
			break
		}
		b, _ := nextFloat64()
		c, _ := nextFloat64()
		d, _ := nextFloat64()
		e, _ := nextFloat64()
		f, _ := nextFloat64()

		detA := a*e - b*d
		x := (c*e - b*f) / detA
		y := (a*f - c*d) / detA

		fmt.Printf("%.3f %.3f\n", round(x), round(y))
	}
}

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

int main(){
  int i;
  float x[6];
  int y1, y2, re1, re2;

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

    //normalize
    x[1]/=x[0]; x[2]/=x[0]; x[0]=1;

    //subtraction
    x[4]-=x[3]*x[1]; x[5]-=x[3]*x[2]; x[3]=0;

    //normalize
    x[5]/=x[4]; x[4]=1;

    //subtraction
    x[2]-=x[1]*x[5]; x[1]=0;

    y1=(int)(x[2]*10000); y2=(int)(x[5]*10000);
    re1=y1%10; re2=y2%10;
    if(re1<5) y1-=re1;
    else y1+=10-re1;
    if(re2<5) y2-=re2;
    else y2+=10-re2;
    printf("%.3f %.3f\n", (float)y1/10000.0f, (float)y2/10000.0f);
  }

  return 0;
}

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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

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

C++: #include<iostream>
using namespace std;
void sort(int &a, int &b, int &c);

int main() {
	int a,b,c,d,p,q;
	while(cin>>a>>b>>p>>c>>d>>q) {
		double x=(d*p-b*q)/(d*a-b*c);
		double y=(c*p-a*q)/(c*b-a*d);

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
	while(!cin.eof()){
		int a,b,c,d,e,f;
		cin>>a>>b>>c>>d>>e>>f;
		double d1,d2,d3;
		d1=a*e-b*d;
		d2=c*e-b*f;
		d3=a*f-c*d;
		printf("%.3f %.3f\n",d2/d1,d3/d1);
	}
	return 0;	
}

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

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

}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	double a,b,c,d,e,f;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
		double A = b/a-e/d;
		double B = c/a-f/d;
		
		double y = B/A;
		double x = c/a-b/a*y;
		
		
		printf("%.9lf %.9lf\n",x,y);
	}
}

C++: #include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

// ガウスの消去法（Gauss elimination）
// O(n^3)
// 
// Verified:
//   http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3437138

using Num = double;
using Vec = vector<Num>;
using Mat = vector<Vec>;
tuple<bool, int, Vec> gaussianElimination(Mat A, Vec b) {
	const Num EPS = 1e-5; // 誤差
	const int n = A.size(), m = A[0].size();
	int rank = 0, cj = 0;
	while (rank < n && cj < m) {
		// A[rank][cj] が最大になるように
		for (int i = rank + 1; i < n; i++) {
			if (abs(A[i][cj]) > abs(A[rank][cj])) {
				A[i].swap(A[rank]);
				swap(b[i], b[rank]);
			}
		}
		if (abs(A[rank][cj]) > 0) {
			// 係数を 1 に
			Num d = A[rank][cj];
			for (int j = 0; j < m; j++)
				A[rank][j] /= d;
			b[rank] /= d;
			// 前進消去（forward elimination）
			for (int i = rank + 1; i < n; i++) {
				Num k = A[i][cj];
				for (int j = 0; j < m; j++)
					A[i][j] -= k * A[rank][j];
				b[i] -= k * b[rank];
			}
			rank++;
		}
		cj++;
	}
	// 0 != b[i] だったら不能
	for (int i = rank; i < n; i++)
		if (abs(b[i]) > EPS)
			return make_tuple(false, rank, Vec());
	// 不定
	// rank != m
	// cj < m => n < m
	if (rank < m || cj < m)
		return make_tuple(true, rank, Vec());
	// 後退代入（back substitution）
	for (int j = m - 1; j >= 0; j--)
		for (int i = 0; i < j; i++)
			b[i] -= b[j] * A[i][j];
	return make_tuple(true, rank, b);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(3);
	for (double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;) {
		Mat A = { { a,b },{ d,e } };
		Vec B = { c,f };
		auto res = gaussianElimination(A, B);
		Vec ans = get<2>(res);
		cout << ans[0] << " " << ans[1] << endl;
	}
	return 0;
}

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

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

    double temp=b/e;
    double x,y;
    x=(c-temp*f)/(a-temp*d);
    temp=a/d;
    y=(c-temp*f)/(b-temp*e);
    cin>>a>>b>>c>>d>>e>>f;
    double x2,y2;
    temp=b/e;
    x2=(c-temp*f)/(a-temp*d);
    temp=a/d;
    y2=(c-temp*f)/(b-temp*e);


    cout.setf(ios::fixed);
    cout.precision(3);
    cout<<x<<" "<<y<<endl;
    cout<<x2<<" "<<y2;

    return 0;
}