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>
#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;
}

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

int main() {
	double a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		printf("%.3f", (c*e - b*f) / (a*e - d*b));
		cout << ' ' ;
		printf("%.3f", (c*d - a*f) / (b*d - a*e));
		cout << endl;
	}
}

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

C++: #include <iostream>
#include <algorithm>
#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=(a*f-c*d)/(a*e-b*d);
    x=(c-b*y)/a;
    cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>

using namespace std;

int main()
{
int a,b,c,d,e,f;
double A[2][2];
double B[2];
double inv_A[2][2];
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
int det = a*e-b*d;
A[0][0]=a; A[0][1] = b;
A[1][0]=d; A[1][1] = e;
B[0] = c;
B[1] = f; 

inv_A[0][0]=1.0/(double)det *A[1][1]; inv_A[0][1]=1.0/(double)det *-A[1][1];
inv_A[1][0]=1.0/(double)det *-A[1][0]; inv_A[1][1]=1.0/(double)det *A[0][0];

double res[2];
res[0]=0;
res[1]=0;

for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<2;k++){
res[i]+=inv_A[j][k]*B[k];
}
}
}

printf("%.3f %.3f\n",res[0],res[1]);
}

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

int main(int argc, char **argv){
	double a = 0;
	double b = 0;
	double c = 0;
	double d = 0;
	double e = 0;
	double f = 0;

	while(std::cin >> a >> b >> c >> d >> e >> f){
		double det = a * e - b * d;
		double x = (c * e - b * f) / det;
		double y = (a * f - c * d) / det;

		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}
	return 0;
}