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
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

C++: #include<stdio.h>
main(){
  double a,b,c,d,e,f;
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!="EOF"){
    printf("%f %f\n",(c*e-b*f)/(a*e-b*d),(a*f-c*d)/(a*e-b*d));
  }
}

C++: #include <iostream>

double det(double mat[2][2]) {
    double det = 0.0 ;
    det = mat[0][0]*mat[1][1] ;
    det -= mat[0][1]*mat[1][0] ;
    return det ;
}


double **inv(double (&mat)[2][2]) {
    
    double detNum = 1.0/det(mat) ;
    double dotMat[2][2] = {
        {  mat[1][1]*detNum, -mat[0][1]*detNum },
        { -mat[1][0]*detNum,  mat[0][0]*detNum }
    } ;
    
    double **p = (double **)malloc(sizeof(double *) * 2) ;
    for (int i=0; i<2; i++) {
        p[i] = (double *)malloc(sizeof(double) * 2) ;
        for (int j=0; j<2; j++) {
            p[i][j] = dotMat[i][j] ;
        }
    }
    return p;
    
}

double **dot(double (&mat1)[2][2], double (&mat2)[2][1]) {
    
    
    double mat3[2][1] ;
    
    for (int n=0; n<2; n++) {
        double sum = 0 ;
        for (int m=0; m<2; m++) {
            sum += mat1[n][m]*mat2[m][0] ;
        }
        mat3[n][0] = sum ;
    }
    
    
    
    double **p = (double **)malloc(sizeof(double *) * 2) ;
    for (int i=0; i<2; i++) {
        p[i] = (double *)malloc(sizeof(double)) ;
        p[i][0] = mat3[i][0] ;
    }
    return p;
}



int main(int argc, const char * argv[]) {
    double a, b, c, d, e, f ;
    while (1) {
        std::cin >> a >> b >> c >> d >> e >> f ;
        
        if (std::cin.fail()) break ;
        
        double A[2][2] = {
            { a, b },
            { d, e }
        } ;
        double P[2][1] = {
            { c },
            { f }
        } ;
        
        auto invAp = inv(A) ;
        double invA[2][2] ;
        for (int i=0; i<2; i++) {
            for (int j=0; j<2; j++) {
                invA[i][j] = invAp[i][j] ;
            }
        }
        
        
        auto X = dot(invA, P) ;
        
        printf("%.3f %.3f\n", X[0][0], X[1][0]) ;
        
        free(invAp) ;
        free(X) ;
    }
    return 0;
}

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

// 一行取って、一番初めのTを習得
template <class T> int streamvar(std::istream& in, T& var)
{
    string s;
    if (!in) {
        return 1;
    }
    getline(in, s);
    istringstream is(s);
    is >> var;
    if (is.fail()) 
        return 1;
    return 0;
}
// 一行取って、T vectorに格納する
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) 
        return 1;
    getline(in, s);
    if (in.fail()) 
        return 1;
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

#define EPS 1e-6
int main(void)
{
    vector<int> v;
    while (!streamvec(cin, v)) {
        double det = v[0] * v[4] - v[3] * v[1];
        double x = v[4] * v[2] - v[1] * v[5];
        double y = -v[3] * v[2] + v[0] * v[5];
        printf("%.3f %.3f\n", round(x/det*1000)/1000+EPS, round(y/det*1000)/1000+EPS);
    }
    return 0;
}

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

int main() {
	// your code goes here

  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);
    double y = (c-a*x)/b;
    if(x == -0.0){
      x = 0.0;
    }
    if(y == 0.0){
      y = 0.0;
    }

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

  }
	return 0;
}

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

using namespace std;

int main() {

	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))  <<  ((a*f-c*d)/(a*e-b*d)) << endl;
	
	}

	return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(8);
    double a1, b1, c1, a2, b2, c2;
    while(cin>>a1>>b1>>c1>>a2>>b2>>c2){
        double m = a1*b2-a2*b1;
        double x=(c1*b2-c2*b1)/m, y=(a1*c2-a2*c1)/m;
        if(abs(x)<1e-9) x=0;
        if(abs(y)<1e-9) y=0;
        cout<<x<<' '<<y<<'\n';
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],det,i[2][2],x[2];
  while(cin >>m[0][0]>>m[0][1]>>x[0]>>m[1][0]>>m[1][1]>>x[1]){
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    i[0][0] = m[1][1]/det;
    i[0][1] = -m[0][1]/det;
    i[1][0] = -m[1][0]/det;
    i[1][1] = m[0][0]/det;
    printf("%.3lf %.3lf\n",i[0][0]*x[0]+i[0][1]*x[1],i[1][0]*x[0]+i[1][1]*x[1]);
  }
 return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
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);
    double y=(c-a*x)/b;
    printf("%.3f %.3f\n",x,y);
  }
  

}

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

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;
double sg(double n); 
int main()
{
	int a[1000],b[1000],c[1000],d[1000],e[1000],f[1000];
	float x[1000],y[1000];
	int w_x,w_y;
	int len=0;
	while (cin >> a[len] >> b[len] >> c[len] >> d[len] >> e[len] >> f[len])
		len++;

	for (int i=0; i < len; i++) {
		x[i] =  ((e[i] * c[i] - b[i] * f[i]) / (e[i] * a[i] - b[i] * d[i]));
		y[i] =  ((c[i] * d[i] - f[i] * a[i]) / (b[i] * d[i] - a[i] * e[i]));
	}
	for (int i=0; i < len; i++) {
		printf("%.3lf %.3lf\n",sg(x[i]),sg(y[i]));
	}
	return 0;
}
double sg(double n)
{
	return n+0.0005;
}