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>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

double se(double x){
    x*=10000.0;
    if((int)x%10>=5){
        x+=10.0;
    }
    x/=10000.0;
    
    return x;
}

int main(){
    double a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d>>e>>f){
        printf("%.3f",se((c*e-f*b)/(a*e-b*d)));
        cout<<" ";
        printf("%.3f",se((a*f-c*d)/(a*e-b*d)));
        cout<<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 = 0.0;
        y = 0.0;
        
                
        y = (c*d-f*a)/(b*d-a*e);
        
        x = (c*e-f*a)/(a*e-b*d);

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

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

int main(){
	double a, b, c, d, e, f, x, y;
	
	while(std::cin>>a>>b>>c>>d>>e>>f){
	
		y = (d*c-a*f) / (b*d-a*e); // 連立方程式のyの解
		x = (c-b*y) / a; // xの解
		
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << "\n"; // 桁数の調整
	}
	return 0;
}

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

C++: #include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
        double a, b, c, d, e, f, g, h, i, j, k, l, m, n, x, y;

        while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF){
                g = a * d;      //公倍数
                j = b;
                k = c;
                l = a;
                b *= g / a;
                c *= g / a;
                e *= g / d;
                f *= g / d;
                a *= g / a;
                d *= g / d;

                h = b - e;
                i = c - f;

                y = i / h;
                x = k - y * j;
                x /= l;
                y *= 1000;
                y = floor(y + 0.5);
                y /= 1000;
                x *= 1000;
                x = floor(x + 0.5);
                x /= 1000;

                printf("%.%df %.3f\n", x, y);
        }

        return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double a[60000000]={0};
	int i=0;
	while(cin>>a[i++]);
	int n=i-1;
	for(int j=0;j<n;j+=6){
		double k=a[j]/a[j+3],x=0,y=0;
		a[j+3]*=k,a[j+4]*=k,a[j+5]*=k;
		y=(a[j+2]-a[j+5])/(a[j+1]-a[j+4]);
		x=(a[j+2]-a[j+1]*y)/a[j];
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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

int main(){
  while(cin){
    double A[2][3];
    for(int i=0;i<2;i++){
      for(int j=0;j<3;j++){
	cin>>A[i][j];
      }
    }
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++){
	A[i][j] /= A[i][i];
      }
      for(int k=0;k<2;k++){
	if(k!=i){
	  
	  for(int j=i+1;j<3;j++) A[k][j] -= A[k][i]*A[i][j];
	}
      }
    }
    cout<<fixed<<setprecision(3)<<A[0][2]<<" "<<A[1][2]<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
 double a,b,c,d,e,f,y[10000],x[10000];
 int i=0,n;
while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
  y[i]=((c*d)-(a*f))/((b*d)-(a*e));
  x[i]=((c*e)-(b*f))/((a*e)-(b*d));
  i++;
}
  n=i;
  for(i=0;i < n; i++){
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3lf %.3lf\n", x[i],y[i]);
  }
  return 0;
}

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

using namespace std;

typedef struct {
        double x1;
        double x2;
} answer;

answer solve_simultaneous_equations(double a, double b, double c, double d, double e, double f) {
        answer ans;
        ans.x1 = (c*e - b*f) / (a*e - b*d);
        ans.x2 = (c*d - a*f) / (b*d - a*e);
        return ans;
}

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

        while(cin >> a >> b >> c >> d >> e >> f) {
                answer ans;
                ans = solve_simultaneous_equations(a,b,c,d,e,f);
                cout << showpoint << fixed << setprecision(3) << ans.x1;
                cout << " ";
                cout << showpoint << fixed << setprecision(3) << ans.x2;
                cout << endl;
        }

        return 0;
}

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

int main(){
double a,b,j,d,e,f,a_,b_,c_,d_,e_,f_;
double x,y;
double in;
while (std::cin >>a>>b>>c>>d>>e>>f){
in_ = (a*e - b*d);
a_ = a/in;
b_ = -1*d/in;
d = -1*b/in;
e_ = e/in;
x = c * a_ + f*b_;
y = c*d_ + f*e_;
std::cout << std::setprecision(3) << x << ' ' << std::setprecision(3) << y << std::endl;
}
    return 0;
}

C++: #include <stdio.h>

double sishagonyu(double num)	{
	
	int num2;
	
	if (num == 0) return num;
	if (num > 0) { 
		num += 0.0005;
	} else {
		num -= 0.0005;
	}
	
	num *= 1000;
	num2 = (int)num;
	num = num2;
	num /= 1000;
	
	return num;
}

int main() {
	
	double a, b, c, d, e, f;	//scanf
	double x, y;							//ans
	
	double n = 0, m = 0, j = 0, h = 0, i = 0;						//temp
	
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		
		//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;
		
		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);
		
		//x = sishagonyu(x);
		//y = sishagonyu(y);
		
		//printf("%lf %lf\n", x, y);
		printf("%.3lf %.3lf\n", x, y);
			}
	return 0;
}