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;

int main(){
  double a, b, c, d, e, f;
  
  while(cin >> a >> b >> c >> d >> e >> f){
    cout << fixed << setprecision(3);

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

    cout << x << " " << y << endl;
  }
}

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

int main(void){
	double a,b,c,d,e,f;
	double x,y;
	cout.precision(3);
	cout << setiosflags(ios::fixed);
	while(cin >> a >> b >> c >> d >> e >> f ){
		b/=a; c/=a; a=1.0;
		e/=d; f/=d; d=1.0;
		y=(c-f)/(b-e);
		x=c-b*y;
		cout << x << " " << y << endl;
	}
	return 0;
}

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

/*
??£???????¨????
	ax + by = c
	dx + ey = f
????§£x, y???????????????????????°??????
*/
int main() {
	double a, b, c, d, e, f;
	int cnt = 0;						//??\??????????????£???????¨????????????°
	std::vector<double> x_vector;		//x????§£???????´?
	std::vector<double> y_vector;		//y????§£???????´?

#if 0
	while (cnt < 2) {
		cin >> a >> b >> c >> d >> e >> f;
#else
	while (cin >> a >> b >> c >> d >> e >> f) {
#endif
		double x = (b * f - c * e) / (b * d - a * e);
		double y = (c * d - a * f) / (b * d - a * e);

		cnt++;
		x_vector.push_back(x);
		y_vector.push_back(y);
	}

	for (unsigned int i = 0; i < cnt; i++) {
		double x_result = round(x_vector[i] * 1000) / 1000;
		double y_result = round(y_vector[i] * 1000) / 1000;

		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x_result << " ";
		std::cout << std::setprecision(3) << y_result << endl;
	}

	//???????????°
	//while (1);

	return 0;
}

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

int main(){
	
	int a,b,c,d,e,f;
	
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != -1){
		
		double del = a*e - b*d;
		printf("%.3lf %.3lf\n",(e*c-b*f)/del,(-d*c+a*f)/del);
	}
	
	return 0;
}

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

double ans(double a,double b,double c,double d,double e,double f){
    double y1=b*d;
    double a1=c*d;
    double y2=e*a;
    double a2=f*a;
    double y=y1-y2;
    double a3=a1-a2;
    return a3/y;
}

int main(){
    double a,b,c;
    double d,e,f;
    cin>>a>>b>>c;
    cin>>d>>e>>f;
    double x=ans(b,a,c,e,d,f);
    double y=ans(a,b,c,d,e,f);
    if(x<0||0.0005+x>=0){
        x=-x;
    }
    if(y<0||0.001+y>0){
        y=-y;
    }
    cout<<fixed<<setprecision(3)<<x<<' '<<setprecision(3)<<y<<endl;
}

C++: #include <iostream>
#include <cstdio>
int main(){
float a,b,c,d,e,f;
while(std::cin>>a>>b>>c>>d>>e>>f)printf("%.3f %.3f\n",(f*b-e*c)/(d*b-a*e), (f*a-d*c)/(a*e-b*d));
}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(void)
{
    const double eps = 1e-9;
    string str;
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double delta = a * e - b * d;
        double x = 1.0 / delta * (c * e - b * f) + eps;
        double y = 1.0 / delta * (-d * c + a * f) + eps;
        printf("%.3f %.3f\n", x, y);
    }
    
    return 0;
}

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

#define ROUND_RANK 4

//ax+by=c
//dx+ey=f

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& q2, const double& p11, const double& q1, const double& p21) {
	return ((q2*p11 - p21*q1) / det);
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	double	a, b, c, d, e, f;//データセット
	double  det;//行列式
	double	x, y;//解
	std::cin >> a >> b >> c >> d >> e >> f;
	det = Calc_det(a, b, d, e);
	x = Calc_x(det, c, e, b, f);
	y = Calc_y(det, a, f, c, d);
	x = Round(x, ROUND_RANK);
	if (x == 0)x = 0;
	y = Round(y, ROUND_RANK);
	if (y == 0)y = 0;
	std::cout << std::fixed;
	std::cout << std::setprecision(3) << x << " ";
	std::cout << std::setprecision(3) << y << std::endl;
}

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

#define     MAX_LENGTH     255

using namespace std;

double num_abs_round(const double,const int);

int main(){
	double a,b,c,d,e,f;
	double det;
	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);
		y = num_abs_round(y,3);

		// 表示する
		printf("%.3f %.3f\n",x,y);
	}

	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,(p * (-1)));
	}

	return rtn;
}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main() {
int a,b,c,d,e,f;
while (cin>>a>>b>>c>>d>>e>>f) {
 double Dx = c*e-b*f;
 double Dy = a*f-c*d;
 double D  = a*e-b*d;
 double x = Dx/D;
 double y = Dy/D;
 if (x==-0.) x=0;
 if (y==-0.) y=0;
 cout << fixed << setprecision(3) << x << ' ' << y << endl;
 }
return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main() {
    double a,b,c,d,e,f;
    while (cin >> a >> b>>c>>d>>e>>f) {
        printf("%.3f %.3f\n",(c*e-b*f)/(a*e-b*d),(a*f-c*d)/(a*e-b*d));
        
    }
}