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 <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)
{
  if (f == 0) {
    f = 0;
  }
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

void calc_and_output(int *c)
{
  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;
}

int main(int argc, char const* argv[])
{
  int c[6];

  string line;
  while (getline(cin, line)) {
    istringstream iss(line);
    int val;
    int c[6];
    for (int i = 0; i < 6; i++) {
      iss >> val;
      c[i] = val;
    };

    calc_and_output(c);
  }

  return 0;
}

C++: #include<stdio.h>
int main()

{
    int a,b,c,d,e,f;
    while(~scanf("%d%d%d%d%d%d",a,b,c,d,e,f))
    {
        
        float x=(c*e-b*f)/(a*e-b*f);
        float y=(c*d-a*f)/(b*d-a*e);
        printf("%.3f %.3f\n",x,y);
        
    }
    return 0;
}

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

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

C++: #include <bits/stdc++.h>

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i <= _##i poi i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i < _##i poi i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i >= _##i poi i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i > _##i poi i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

using namespace std;

bool pyon(int a, int b, int c){
    return c && a * a + b * b == c * c poi
}

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

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

int main()
{
	for (double a, b, c, d, e, f, x, y; cin >> a >> b >> c >> d >> e >> f; cout << fixed << setprecision(3) << x << ' '  << y << endl) {
		int tmp;
		x = ((c*e - b*f) ? (c*e - b*f) / (a*e - b*d) : 0.0000);
		if (x < 0) {
			x -= 0.0005;
		}
		else if (x>0) {
			x += 0.0005;
		}
		x = int(x * 1000) / 1000.0;
		y = ((a*f - c*d) ? (a*f - c*d) / (a*e - b*d) : 0.0000);
		if (y > 0) {
			y += 0.0005;
		}
		else if (y < 0) {
			y -= 0.0005;
		}
		y = int(y * 1000) / 1000.0;
	}
	return 0;
}

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

#define N 2

using namespace std;

int main(){
	double a[N][N+1];
	double d;
	int i, j, k;
	bool flag = 1;

	while(cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[1][0] >> a[1][1] >> a[1][2]){
		for(k = 0; k < N - 1; k++){
			for(i = k+1; i < N; i++){
				d = a[i][k] / a[k][k];
				for(j = k + 1; j <= N; j++){
					a[i][j] = a[i][j] - a[k][j] * d;
				}
			}
		}
		for(i = N - 1; i >= 0; i--){
			d = a[i][N];
			for(j = i + 1; j < N; j++){
				d = d - a[i][j] * a[j][N];
			}
			a[i][N] = d / a[i][i];
		}
		printf("%.3f %.3f\n", a[0][N], a[1][N]);
	}
	return 0;
}

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

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

  while( cin >> a >> b >> c >> d >> e >> f ){
    cout << fixed << setprecision(3) << (b*f - c*e) / (b*d - a*e) << " ";
    cout << fixed << setprecision(3) << (c*d - a*f) / (b*d - a*e) << endl;
}  

  return 0;
}

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

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

      if(x == 0)
	{
	  x = 0.000;
	}
      if(y == 0)
	{
	  y = 0.000;
	}
      
      
      printf("%.3f %.3f\n",x,y);
      
    }

  return 0;
}

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

int main(){
  int i = 0;
  while(1){
  i++;
  int a, b, c, d, e, f;
  scanf("%d ",&a);
  scanf("%d ",&b);
  scanf("%d ",&c);
  scanf("%d ",&d);
  scanf("%d ",&e);
  scanf("%d ",&f);
  
  double x, y;
  x = (double)(c*e-b*f) / (double)(a*e-b*d);
  y = (double)(a*f-c*d) / (double)(a*e-b*d);
  x = (double)round(x*10000.0) / 10000.0;
  y = (double)round(y*10000.0) / 10000.0;
  printf("%.3f %.3f\n", x, y);
  
  if(scanf()==EOF) break;
  else{
    int line = i * 6
    fseek(STDIN, lineL, SEEK_SET);
  }
  }
  
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  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);
    if(x==-0){
      x=0;
    }
    y=(d*c-a*f)/(d*b-a*e);
    if(y==-0){
      y=0;
    }
    cout << x <<" "<< y << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y,hy,dk;
  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;
    /*if(x>0) x += 0.0005;
    else if(x<0)x -= 0.0005;
    if(y>0) y += 0.0005;
    else if(y<0)y -= 0.0005;*/
    cout << fixed << setprecision(3) << x << ' ' << y << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main(){
	int a,b,c,d,e,f,two,three;
	while (cin >> a >> b >> c >> d >> e >> f){
		two = b*d-e*a;
		three = c*d - f*a;
		std::cout << std::setprecision(4) << c - b*three / two << " " << three / two << endl;
	}
	return 0;
}