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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

int main(){
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double delta = a*e-b*d;
        double x = round((e*c-b*f)/delta * 1000)/1000;
        double y = round((-d*c+a*f)/delta*1000)/1000;
        if(x==0) x = 0.000;
        if(y==0) y = 0.000;
        printf("%.3lf %.3lf\n", x, y);    
    }
    return 0;
}

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

#define     MAX_LENGTH     255
// #define     __DEBUGING__

using namespace std;

double num_abs_round(const double,const int);

int main(){
#ifdef __DEBUGING__
	double ip;
	int n;

	while(cin >> ip >> n){
		cout << num_abs_round(ip,n) << endl;
		printf("%.3f\n",num_abs_round(ip,n));
	}
#else
	double a,b,c,d,e,f;
	double det;
	double x,y;
	double X,Y;

	while (cin >> a >> b >> c >> d >> e >> f){
		// Det(係数行列) を計算
		det = (a * e) - (b * d);
		// Det(係数行列) ≠ 0 かどうかをチェック
		if(det == 0){
			cerr << "エラー：この連立方程式の解は存在しないか一意に定まらない" << endl;
			return -1;
		}

		// 解を求める
		x = ((e * c) - (b * f)) / det;
		y = ((a * f) - (d * c)) / det;

		// 整形
		X = num_abs_round(x,3) * ((x >= 0) ? 1 : (-1));
		Y = num_abs_round(y,3) * ((y >= 0) ? 1 : (-1));

		// 表示する
		printf("%.3f %.3f\n",X,Y);
	}
#endif

	return 0;
}

double num_abs_round(const double num,const int p){
	char num_str[MAX_LENGTH];
	char rtn_str[MAX_LENGTH];
	int i,j;
	bool flag = false;
	double rtn;

	// rtn_str の初期化
	for(i=0;i < ((int)(MAX_LENGTH));i++){
		rtn_str[i] = '\0';
	}

	// 数値を文字列に変換
	sprintf(num_str,"%f\0",num);

	// 符号の確認
	if(num_str[0] == '-'){
		j = 1;
		rtn_str[0] = '0';
	}else{
		j = 0;
	}

	// 小数点の検索 (num_str[j] に '.' が入っている)
	for(;num_str[j] != '.';j++){
		// 小数点がなければ num をそのまま返す
		if(num_str[j] == '\0'){
			return num;
		}
		// rtn_str に num_str をコピー
		rtn_str[j] = num_str[j];
	}

	// '.'をコピー
	rtn_str[j] = '.';

	// 小数点以下 (p + 1) 桁までをコピー
	for(i=1;i <= (p + 1);i++){
		// num が (p + 1) 桁未満だったら num をそのまま返す
		if(num_str[(j + i)] == '\0'){
			return num;
		}
		// rtn_str に num_str をコピー
		rtn_str[(j + i)] = num_str[(j + i)];
	}

	// 小数点以下 (p + 1) 桁を四捨五入
	if(((rtn_str[(j + p + 1)] - '0') >= 0) && ((rtn_str[(j + p + 1)] - '0') <= 4)){
		rtn_str[(j + p + 1)] = '\0';
	}else if((((int)(rtn_str[(j + p + 1)] - '0')) >= 5) && (((int)(rtn_str[(j + p + 1)] - '0')) <= 9)){
		flag = true;
		rtn_str[(j + p + 1)] = '\0';
	}else{
		return 0;
	}

	// rtn_str を数値に変換
	rtn = atof(rtn_str);

	// 五入の場合の処理
	if(flag == true){
		rtn += pow((double)10,(double)(p * (-1)));
	}

	return rtn;
}

C++: #include<iostream>
#include<iomanip>
#include<stdio.h>
#include<cmath>

using namespace std;

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

	while(true){
		cin >> a >> b >> c >> d >> e >> f;

		double tempb = b;

		a*=e;b*=e;c*=e;
		d*=tempb;e*=tempb;f*=tempb;
		a-=d;b-=e;c-=f;

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

		if(x == -0)
			x = 0;
		if(y == -0)
			y = 0;
		x = floor((x+0.0005)*1000)/1000;
		y = floor((y+0.0005)*1000)/1000;
		printf("%0.3lf %0.3lf\n",x,y);
	}

	return 0;
}

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

int main(int argc, char *argv[]){
    double a,b,c,d,e,f;
	
	while(cin >> a>> b >> c>> d>> e >>f){
		double x,y;
		double b0,c0,e0,f0;

		b0=b*d; c0=c*d;
		e0=e*a; f0=f*a;
		
		y=(c0-f0)/(b0-e0);
		x=(c-b*y)/a;

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

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    double a,b,c,d,e,f,x,y;
    while(cin >> a >> b >> c >> d >> e >> f){
        x=(e*c-b*f)/(a*e-b*d);
        y=(-d*c+a*f)/(a*e-b*d);
        if(x==0)x=0;
        if(y==0)y=0;
        cout<<fixed<<setprecision(3)<<x<<" "<<fixed<<setprecision(3)<<y<<endl;
    }
    return 0;
}

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

}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    double a, b, c, d, e, f, 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);
		
		x*=1000;y*=1000;
		if(x<0){
			x-=0.5;
		}else{
			x+=0.5;
		}
		if(y<0){
			y-=0.5;
		}else{
			y+=0.5;
		}
		int xi = (int)x;
		int yi = (int)y;
		x = (double)xi;
		y = (double)yi;
		x/=1000;y/=1000;
		
		printf("%.3f %.3f\n", x, y);
	} 
	return 0;
}

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

using namespace std;

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

double round3(double dat){

	int fct;
	fct = (int)pow(10, 3);
	dat *= fct;
	dat = round(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2, a, b, c, d, e, f;

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

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

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

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);




	cout << fixed << setprecision(3) << round3(x1) << " " << round3(y1) << endl;
	cout << fixed << setprecision(3) << round3(x2) << " " << round3(y2) << endl;

	return 0;
}

double x(double a, double b, double c, double d, double e, double f) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double a , double b, double c, double d, double e, double f) {

	return (a*f - c*d) / (a*e - b*d);
}

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

using namespace std;

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

  while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
    double x, y;
    double denom = a * e - b *d;
    double nomer_x = c*e - b*f;
    double nomer_y = -c*d + a*f;
    x = nomer_x / denom;
    y = nomer_y / denom;
    int f1 = 0, f2 = 0;
    if((int)x == 0) {
      printf("0.000 ");
      f1 = 1;
    }
    if(f1 == 0) {
      printf("%.3lf ", x);
    }
    if((int)y == 0) {
      printf("0.000\n");
      f2 = 1;
    }
    if(f2 == 0) {
      printf("%.3lf\n", y);
    }
  }

  return 0;
}