Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

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]
		var mulA, mulD int
		if a < 0 {
			mulA = a * -1
		} else {
			mulA = a
		}
		if d < 0 {
			mulD = d * -1
		} else {
			mulD = d
		}
		a *= mulD
		b *= mulD
		c *= mulD
		d *= mulA
		e *= mulA
		f *= mulA

		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.Print(x)
		fmt.Println(".000")
		fmt.Print(y)
		fmt.Println(".000")
	}
}

C++: #include<cstdio>
using namespace std;
int main(){
	for(;;){
		double matrix[2][2],reverse[2][2],ans[2],x,y,det;
		if(scanf("%lf %lf %lf %lf %lf %lf",&matrix[0][0],&matrix[1][0],&ans[0],&matrix[0][1],&matrix[1][1],&ans[1]) == EOF){break;}
		det = matrix[0][0]*matrix[1][1]-matrix[0][1]*matrix[1][0];
		reverse[0][0] = matrix[1][1]/det;
		reverse[1][0] = -matrix[1][0]/det;
		reverse[0][1] = -matrix[0][1]/det;
		reverse[1][1] = matrix[0][0]/det;
		x = ans[0]*reverse[0][0]+ans[1]*reverse[1][0];
		y = ans[0]*reverse[0][1]+ans[1]*reverse[1][1];
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <cstdio>

int main (int argc, char *argv[]) {
	using namespace std;
	int a, b, c, d, e, f;
	while (EOF != fscanf(stdin, "%d %d %d %d %d %d\n", &a, &b, &c, &d, &e, &f)) {
		float tmp1 = static_cast<float>(f)-(static_cast<float>(c)*static_cast<float>(d)/static_cast<float>(a));
		float tmp2 = static_cast<float>(e)-(static_cast<float>(b)*static_cast<float>(d)/static_cast<float>(a));
		float y = tmp1/tmp2;
		float x = (static_cast<float>(c) - static_cast<float>(b) * y) / static_cast<float>(a);
		printf("%f %f\n", x, y);		
		//printf("y=%f\n", (f-(c*d/a))/(e-(b*d/a)));
	}
	
	return 0;
}

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

using namespace std;

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

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

C++: /*
    AOJ Volume0 0003

    Simultaneous Equation

    Write a program which solve a simultaneous equation:
        ax+by=c
        dx+ey=f

    The program should print x and y for given 
    a, b, c, d, e and f (-1,000 ≤ a,b,c,d,e,f ≤ 1,000).
    You can suppose that given equation has a unique solution.
    
    Input
        The input consists of several data sets, 1 line for each data set.
        In a data set, there will be a,b,c,d,e,f separated by a single space.
        The input terminates with EOF.

    Output
        For each data set, print x and y separated by a single space.
        Print the solution to three places of decimals. Round off the solution to three decimal places.

    Sample Input 1
        1 2 3 4 5 6
        2 -1 -2 -1 -1 -5

    Output for the Sample Input 1
        -1.000 2.000
        1.000 4.000

    Sample Input 2
        2 -1 -3 1 -1 -3
        2 -1 -3 -9 9 27

    Output for the Sample Input 2
        0.000 3.000
        0.000 3.000


*/

#include <iostream>
#include <iomanip>

int main(void)
{

    while(true)
    {
        double a,b,c,d,e,f;
        if(std::cin >> a >> b >> c >> d >> e >> f)
        {
            double rate = d / a; 
            double 
                a2 = a * rate,
                b2 = b * rate,
                c2 = c * rate;

            double
                d2 = d - a2,  // defintly 0
                e2 = e - b2,
                f2 = f - c2;

            double y = f2 / e2;
            double x = (c - b*y) / a;

            std::cout << std::setprecision(3) << std::fixed << x << " " << y << std::endl;
        }

        else break;
    }

    return 0;

}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
constexpr double eps = 1e-9;
int main() {
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f) {
        double x = (c*e - b*f) / (a*e - b*d);
        double y = (c - a*x) / b;
        if(fabs(x) < eps) x = 0;
        if(fabs(y) < eps) y = 0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	while(1){
		double a,b,c,d,e,f;
		std::cin>>a>>b>>c>>d>>e>>f;
		double b2=b*gcd(a,d)/a;
		double e2=e*gcd(a,d)/d;
		double c2=c*gcd(a,d)/a;
		double f2=f*gcd(a,d)/d;
		double y=(f2-c2)/(e2-b2);
		double x=(e-b*y)/a;
		std::cout<<x<<" "<<y<<std::endl;
		break;
	}
	return 0;
}

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

using namespace std;

/* ax + by = c
   dx + ey = f
   
   (x, y) = { (ce - bf) / (ae - bd), (af - cd) / (ae - bd) } */


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

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

	while (cin >> a >> b >> c >> d >> e >> f)
	{
		Equation2(a, b, c, d, e, f, x, y);

		cout << setprecision(3) << x << ' ' << y << endl;
	}

	return 0;
}

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




double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(){
    
	double ax, by, c, dx, ey, f;
    double x, y;
    double l, d1, d2;
        
	while(cin>> ax>> by>> c >> dx>> ey>> f){
        
        x = 0.0;
        y = 0.0;
        
        if(ax == dx){
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        else if (by == ey) {
            ax -= dx;
            x = (c-f) / ax;
            y = (f + dx*(-x)) / ey;
        }
        else{
            l = lcm(fabs(ax), fabs(dx));
            d1 = fabs(l / ax);
            d2 = fabs(l / dx);
            ax *= d1;
            by *= d1;
            c  *= d1;
            dx *= d2;
            ey *= d2;
            f  *= d2;
            
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        
        printf("%.3f %.3f\n", x, y);
        
        
	}
    
    
	return 0;
}

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

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


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

C++: #include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 100
#define MAX_set 200

typedef long long int ll;
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 = (e*c-b*f)/(e*a-b*d);
		if(e*c == b*f)
			x = 0;
	
		printf("%.3f %.3f\n", x, (c-a*x)/b);
	
	
	
	}

}