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
		if bE==0{
		    bE=1
		}
		y := cF / bE
		x := (c - (y * b)) / a

		
			fmt.Printf("%d.000 ", x)
			fmt.Printf("%d.000\n", y)
	}
}

C++: #include <stdio.h>

int main() {
	
	double a, b, c, d, e, f;	//scanf
	double x, y;							//ans
	int t, t2;
	
	double n = 0, m = 0, j = 0, h = 0, i = 0;						//temp
	
	while(1){
		
		if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) break;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\n", a, b, c, d, e, f);	//input
		
		n = a / d;                                             //Xツづーツ堕オツつヲツつスツつ「
		j = d * n; h = e * n; i = f * n;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\t\t%lf\n", a, b, c, j, h, i, n);
		
		m = b - h;
		y = c - i;
		//printf("%lf %lf\n", m, y);
		
		if(y != 0) y /= m;
		//printf("%lf\n", y);
		
		i = c - (b * y);
		x = i / a;
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		if (x > 0) { x += 0.0005; } else { x -= 0.0005; }
		if (y > 0) { y += 0.0005; } else { y -= 0.0005; }
		
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		x *= 1000;
		y *= 1000;
		
		t = (int)x;
		t2 = (int)y;
		
		//printf("x = %lf, y = %lf t = %d, t2 = %d\n", x, y, t, t2);
		
		x = t;
		y = t2;
		
		x /= 1000;
		y /= 1000;
		
		//printf("%lf %lf\n", x, y);
		printf("%.3lf %.3lf\n", x, y);
		//2 -1 -3 1 -1 -3
		//2 -1 -3 -9 9 27

	}
	return 0;
}

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

int main(){
    double a[3],b[3];
    double x=0,y=0;
    while(cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2]){
        x = (b[1]*a[2] - a[1]*b[2])/(a[0]*b[1] - a[1]*b[0]);
        y = (a[0]*b[2] - a[2]*b[0])/(a[0]*b[1] - a[1]*b[0]);
        cout << fixed << setprecision(4) <<  x << " " << y << endl;
    }
}

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

int main(){
  double a,b,c,d,e,f;
  while(cin >> a >> b >> c >> d >> e >> f){
    double x,y;
    if(0 != a * e - d * b){
      x = (e * c - b * f)  / (a * e - b * d);
      y = (a * f - d * c)  / (a * e - b * d);
    }else{
      x = 0;
      y = 0;
    }
    double x_ = round(x * 1000)/1000;
    double y_ = round(y * 1000)/1000;
    if(x_ > -0.001 && x_ < 0.001) { x_ = 0; }
    if(y_ > -0.001 && y_ < 0.001) { y_ = 0; }
    cout << fixed << setprecision(3) << x_ << " ";
    cout << fixed << setprecision(3) << y_ << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

string float_to_string(float f, int digits)
{
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

int main(int argc, char const* argv[])
{
  int c[6];
  for (int i = 0; i < 6; i++) {
    c[i] = atoi(argv[i+1]);
  }

  float x = (float)(c[1]*c[5]-c[2]*c[4])/(c[1]*c[3]-c[0]*c[4]);
  float y = (float)(c[0]*c[5]-c[2]*c[3])/(c[0]*c[4]-c[1]*c[3]);

  cout << float_to_string(x, 3) << " " << float_to_string(y, 3) << endl;
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-12;

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

  while(scanf("%lf %lf %lf %lf %lf %lf",&a ,&b ,&c ,&d ,&e ,&f) != EOF){

    x=(c*e-b*f)/(a*e-b*d);
    y=(d*c-a*f)/(b*d-a*e);
    if(abs(x) < EPS) x = 0.000;
    if(abs(y) < EPS) y = 0.000;
    printf("%.3lf %.3lf\n",x,y);
  
  }
  
  return 0;
}

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

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

C++: #include<iostream>
#include<iomanip>
#include<cmath>
double r(double x,int n){
  for(int i=0;i<n;i++) x *= 10;
  x = floor(x+0.5);
  for(int i=0;i<n;i++) x /= 10;
  return x;
}
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y,hy,dk;
  int n;
  while(cin>>a>>b>>c>>d>>e>>f){
    a *= d;
    b *= d;
    c *= d;//方程式にd倍
    dk = d;
    d *= (a/dk);
    e *= (a/dk);
    f *= (a/dk);//方程式にa倍
    y = (c-f)/(b-e);
    a /= d;
    b /= d;
    c /= d;//元の方程式
    hy = y * b;
    x = (c-hy)/a;
    cout << fixed << setprecision(3) << r(x,3) << ' ' << r(y,4) << endl;
  }
  return 0;
}

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

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    double a,b,c,d,e,f;
    double x1[1000],x2[1000];
    
    while(
            cin >> a >> b >> c >> d >> e >> f)
    {
        double gyouretusiki = (a*e - d*b);
    
        x1 [n]= (c/a) - (b/gyouretusiki)*(f -((d*c)/a));
    
        x2[n] = ((a) /(gyouretusiki))*(f-((d*c)/a));
        
    
        REP(i,5)
        {
            x1[n] =x1[n]*10;
            x2[n] = x2[n]*10;
        }
            x1[n] += 0.5;
            x2[n] += 0.5;
            x1[n] = (int)x1[n];
            x2[n] = (int)x2[n];
        REP(i,5)
        {
            x1[n] =x1[n]/10;
            x2[n] = x2[n]/10;
        }
        n++;
    }
    REP(i,n)
    printf("%.3f %.3f\n",x1[n],x2[n]);
    return 0;
            
                  
                  
    
}

C++: #include<iostream>
#include<iomanip>
int main()
{
	double result[2000][2];
	int num;
	for(int i = 0;; i++)
	{
		double a, b, c, d, e, f;
		std::cin >> a >> b >> c >> d >> e >> f;
		if(std::cin.eof())
		{
			num = i;
			break;
		}
		result[i][0] = (b * f - c * e) / (b * d - a * e);
		result[i][1] = (c * d - a * f) / (b * d - a * e);
		for(int j = 0; j < 2; j++)
		{
			if(result[i][j] == -0)
			{
				result[i][j] = 0;
			}
		}
	}
	std::cout << std::fixed << std::setprecision(3);
	for(int i = 0; i < num; i++)
	{
		std::cout << result[i][0] << ' ' << result[i][1] << std::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];
  while(~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]=A[1][1]; inv_A[0][1]=-A[0][1];
    inv_A[1][0]=-A[1][0]; inv_A[1][1]=A[0][0];
 
    double res[2];
    res[0]=0;
    res[1]=0;
 
 
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
	res[j]+=1.0/(double)det *inv_A[j][k]*B[k];
      }
    }
 
    printf("%.3f %.3f\n",res[0],res[1]);
  }
}