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 <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cstdio>
#include <cmath>

#define DIM 2
#define EPS (5*10e-4)

typedef std::vector<double> Vec;
typedef std::vector<Vec> Mat;
typedef std::pair<Mat,Vec> Eq;

double removeMinusZero(double x){
	if ( fabs(x)< EPS ){
		return 0.0;
	}
	else {
		return x;
	}
}

int main(void){
	using namespace std;

	list<Eq> input;

	double a,b,c,d,e,f;

	cout << fixed << setprecision(3);

	while(cin >> a >> b >> c >> d >> e >> f){
		Vec m1, m2;
		m1.push_back(a);
		m1.push_back(b);
		m2.push_back(d);
		m2.push_back(e);

		Vec vec;
		vec.push_back(c);
		vec.push_back(f);

		Mat mat;
		mat.push_back(m1);
		mat.push_back(m2);

		Eq eq = make_pair(mat,vec);

		input.push_back(eq);
	}

	for(auto itr = input.begin(); itr!=input.end(); ++itr){
		auto mat = itr->first;
		auto vec = itr->second;

		Vec output(DIM);

		double det = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
		// std::transform(vec.begin(), vec.end(),vec.begin(), std::bind1st(multiplies<double>(),1.0/det));

		mat[0][1] = -mat[0][1];
		mat[1][0] = -mat[1][0];
		swap(mat[0][0],mat[1][1]);

		for (int i=0; i<DIM; i++){
			output[i] = inner_product(vec.begin(), vec.end(), mat[i].begin(), 0);
		}
		std::transform(output.begin(), output.end(),output.begin(), std::bind1st(multiplies<double>(),1.0/det));
		cout << removeMinusZero(output[0]) << " " << removeMinusZero(output[1]) << endl;
	}

}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vector<pair<double, double>> answers;

    double a, b, c, d, e, f;
    while (cin >> a >> b >> c >> d >> e >> f) {
        pair<double, double> ans;
        ans.first = (e * c - b * f) / (a * e - b * d) + 0.0;
        ans.second = (a * f - d * c) / (a * e - b * d) + 0.0;
        answers.push_back(ans);
    }

    for (auto ans : answers) {
        cout.setf(ios::fixed);
        cout.precision(3);
        cout << ans.first << " " << ans.second << endl;
    }
    
    return 0;
}

C++: #include <cstdio>

using namespace std;

double cross(double a, double b, double c, double d)
{
  return a * d - b * c;
}

int main()
{
  double a[3], b[3];
  while (scanf(" %lf %lf %lf %lf %lf %lf ", &a[0],&a[1],&a[2],&b[0],&b[1],&b[2]) == 6) {
    printf("%.3lf %.3lf\n", cross(a[2], a[1], b[2], b[1]) / cross(a[0], a[1], b[0], b[1]), cross(a[0], a[2], b[0], b[2]) / cross(a[0], a[1], b[0], b[1]));
  }
  return 0;
}

C++: #include<iostream>
#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 = (a*f - c*d)/(a*e - d*b);
    y = (c -b*y)/a;

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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
int main() {
	long double a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		c *= (d / a);
		b *= (d / a);
		a *= (d / a);
		long double ansx=0, ansy=0;
		if (f - c != 0) {
			ansy = (f - c) / (e - b);
		}
		if (a != 0) {
			ansx = (c - ansy*b) / a;
		}
		ansx *= 1000;
		ansx = round(ansx);
		ansx /= 1000;
		ansy *= 1000;
		ansy = round(ansy);
		ansy /= 1000;
		if (ansx == 0) ansx = 0;
		if (ansy == 0) ansy = 0;
		printf("%.3LF %.3LF\n", ansx, ansy);
	}
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if ( cin.eof() )
			break;

		double delta = 1.0 / ( a*e - b*d );

		double x = (double)( e * c - b * f ) * delta;
		double y = (double)( a * f - d * c ) * delta;

		cout.setf( ios::showpoint );
		cout.precision( 4 );
		cout << x << " " << y << endl;

	}
}

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




double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(){
    
	double ax, by, c, dx, ey, f;
    double x, y;
    double l, d1, d2;
        
	while(cin>> ax>> by>> c >> dx>> ey>> f){
        
        x = 0.0;
        y = 0.0;
        
        if(ax == dx){
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        else if (by == ey) {
            ax -= dx;
            x = (c-f) / ax;
            y = (f + dx*(-x)) / ey;
        }
        else{
            l = lcm(fabs(ax), fabs(dx));
            d1 = l / ax;
            d2 = l / dx;
            ax *= d1;
            by *= d1;
            c  *= d1;
            dx *= d2;
            ey *= d2;
            f  *= d2;
            
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        
        printf("%.3lf %.3lf\n", x, y);
        
        
	}
    
    
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    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("%0.3lf %0.3lf\n",x,y);
	}
	return 0;
}

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

using namespace std;

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

	cin >> a >> b >> c >> d >> e >> f;

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

	cout >> fixed >> setprecision(3) >> x >> " " >> y >> endl;
	//printf("%.3f %.3f\n", x, y);
}

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

int main() {
    int a, b, c, d, e, f, g;
    while (cin >> a >> b >> c >> d >> e >> f) {
        g = b*d - a*e;
//       if(g == 0) {
//            continue;
//        }
        printf ("%.3f %.3f\n", (double)-(c*e - f*b)/g, (double)(c*d - f*a)/g);
    }
    return 0;
}

C++: #include <stdio.h>

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

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

double r(double d){
  roundl(d*1000)/1000;
}

int main(){
  double a,b,c,d,e,f;
  while(~scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f))
    printf("%.3f %.3f",r((c*e-b*f)/(a*e-b*d)),r((-c*d+a*f)/(a*e-b*d)));
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double a,b,c,d,e,f,a2,b2,c2,d2,e2,f2,e3; // ax+by=c  dx+ey=f
  while(cin >> a >> b >> c >> d >> e >> f){
    a2=a;
    b2=b;
    c2=c;

    a/=b;
    c/=b;
    a*=(-1);
    c*=e;
    a*=e;
    a+=d;
    f-=c;
    double ansx=f/a;
    printf("%.3f ",ansx);
 
    a2*=ansx;
    c2-=a2;
    double ansy=c2/b2;
    printf("%.3f\n",ansy);
  }
  return 0;
}