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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 

const int mod = 1000000007;
const int inf = 1e9;

float round_n(float number, double n)
{
    number = number * pow(10,n-1); 
    number = round(number); 
    number /= pow(10, n-1); 
    if(number == -0) number += 0;
    return number;
}

int main(){
    while(1){
        float a = inf,b,c,d,e,f;
        cin >> a >> b >> c >> d >> e >> f;
        if(a == inf){break;}
        float x = (c*e-b*f)/(a*e-d*b);
        float y = (c*d-a*f)/(b*d-a*e);
        cout << fixed<<setprecision(3) << round_n(x, 4) << " " << fixed<<setprecision(3) << round_n(y,4) << endl;
    }
}

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

using namespace std;

int main(){
    int a,b,c,d,e,f;
    double X[6] = {};
    
    for(int i=0;i<6;i++)
    cin >> X[i];
    
    double y = ( X[2] * X[3] - X[0] * X[5]) / ( X[1] * X[3] - X[0] * X[4] );

    if( X[0] !=0 )
    cout << fixed << setprecision(3) << X[2] - X[1] * y / X[0] << " " << y << "\n";
    
    else
    cout << fixed << setprecision(3) << X[5] - X[4] * y / X[3] << " " << y << "\n";
}

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)!=-1){double y=(a*f-d*c)/(a*e-b*d);double x=(c-b*y)/a;printf("%.3f %.3f\n",x,y);}return 0;}

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

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

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

	while(cin>>a>>b>>c>>d>>e>>f)
	{
		printf("%.3f ",(c*e-b*f)/(a*e-b*d)+0.0005);
		printf("%.3f\n",(d*c-a*f)/(b*d-a*e)+0.0005);


	}


}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
			if(inp[i]>='A' && inp[i]<='Z')
				inp[i]+='a'-'A';
*/

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
 
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 - f * b) / (a * e - d * b);
    	y = (a * f - d * c) / (a * e - d * b);
    	if(abs(x) < 0.0001) x = 0;
    	if(abs(y) < 0.0001) y = 0;
    	printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    int a, b, c, d, e, f;
    while (cin >> a >> b >> c >> d >> e >> f) {
        double det = a * e - b * d;
        int x = e * c - b * f;
        int y = a * f - d * c;
        cout << fixed << setprecision(3);
        if (x == 0) cout << 0 << " ";
        else cout << x / det << " ";
        cout << fixed << setprecision(3);
        if (y == 0) cout << 0 << endl;
        else cout << y / det << endl;
    }
    return 0;
}

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

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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		int a2 = a, b2 = b, c2 = c;
		int g = a, h = d;
		if (g > h) swap(g, h);
		while (g != 0) {
			int k = g;
			g = h%g;
			h = k;
		}
		h = (h*(a / h)*(d / h));
		b = b*(h / a);
		c = c*(h / a);
		e = e*(h / d);
		f = f*(h / d);
		long double ansx = ((long double)(f - c) / (e - b)), ansy;
		ansy = (c2 - ansx*b2) / a2;
		printf("%LF %LF", ansy, ansx);
		cout << endl;
	}
}

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

void solv(
	double a,
	double b,
	double c,
	double d,
	double e,
	double f,
	double & x,
	double & y){
	y = (f - (d*c)/a)/(e - (b*d)/a);
	x = (c - b*y)/a;
}

int main(){
	std::vector<std::pair<double, double>> ans;

	double a,b,c,d,e,f;
	std::pair<double, double> tmp;

	while(true){
		std::cin >> a >> b >> c >> d >> e >> f;
		if(std::cin.eof() == true) break;
		solv(a,b,c,d,e,f,
			tmp.first, tmp.second);
		ans.push_back(tmp);
	}

	for(auto && a : ans){
		printf("%0.4f %0.4f\n", a.first, a.second);
	}
}

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

    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#define eps 1e-9
using namespace std;

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

    while(cin>>a>>b>>c>>d>>e>>f){
        x = ((e*c)-(b*f))/((a*e) - (b*d)) *1.0;
        y = ((a*f) - (c*d))/((a*e) - (b*d)) *1.0;

        printf("%.3lf %.3lf\n",x+eps,y+eps);
    }
    return 0;
}

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

using namespace std;

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

int main(){
	while (1){
		cin >> a >> b >> c >> d >> e >> f;
		y = (c - f*a / d) / (b - e*a / d);
		x = -b / a*y + c / a;
		printf("%.3lf %.3lf\n", x, y);
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

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