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 <iostream>
#include <iomanip>

double getValue(double val);

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

double getValue(double val)
{
    double result;
    val *= 1000;
    if(val >= 0.0){
        result = (int)(val + 0.5);
    }
    else{
        result = (int)(val - 0.5);
    }
    return result / 1000;
}

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

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

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

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

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

int main(void)
{
	int n;
	double a,b,c,d,e,f;
	double det, ia, ib, ic, id;
	double x,y;
	char buf[32];
	while(fgets(buf,32,stdin)!=NULL){
		n=sscanf(buf,"%lf %lf %lf %lf %lf %lf",&a,&b,&e,&c,&d,&f);
		if(n!=6)break;
		det = 1./(a*d - b*c);
		ia=d*det;
		ib=-b*det;
		ic=-c*det;
		id=a*det;
		x=ia*e+ib*f;
		y=ic*e+id*f;
		printf("%.3f %.3f\n", round(x*1000)/1000,round(y*1000)/1000);
	}
	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)
	{
		if (cin.eof()) break;
		y = (c*d - a*f) / (b*d - a*e);
		x = -b/a * y + c/a;
		cout << setprecision(3) << setiosflags(ios::fixed) << x << " " << y << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    double A[2][3];
    while(cin >> A[0][0] >> A[0][1] >> A[0][2] >> A[1][0] >> A[1][1] >> A[1][2]){
        for(int i = 1; i < 3; i++){
            A[0][i] /= A[0][0];
        }
        A[0][0] /= A[0][0];
        for(int i = 1; i < 3; i++){
            A[1][i] -= A[0][i] * A[1][0];
        }
        A[1][0] -= A[0][0] * A[1][0];
        for(int i = 0; i < 3; i++){
            if(i != 1)
                A[1][i] /= A[1][1];
        }
        A[1][1] /= A[1][1];
        for(int i = 0; i < 3; i++){
            if(i != 1)
                A[0][i] -= A[1][i] * A[0][1];
        }
        A[0][1] -= A[1][1] * A[0][1];
        
        printf("%.3f %.3f\n", A[0][2], A[1][2]);
    }
}

C++: /*
 * AOJ 4
 * Simultaneous Equation (PCK 2003)
 *
 */
#include <iostream>

using namespace std;

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

C++: #include<stdio.h>

int main(void)
{
	int a,b,c,d,e,f,t=0,n,cx,cy;
	double x[100]={0},y[100]={0};
	
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		x[t]=(c*e-b*f)/(a*e-b*d);
		y[t]=(d*c-a*f)/(b*d-a*e);
		t++;
	}

	for(n=0;n<t;n++)
	{
		if(x[n]>=0)
		{
			cx=x[n]*10000;
			cx=(cx+5)/10;
			x[n]=cx/1000;
		}
		else if(x[n]<0)
		{
			cx=x[n]*10000;
			cx=(cx-5)/10;
			x[n]=cx/1000;
		}

		if(y[n]>=0)
		{
			cy=y[n]*10000;
			cy=(cy+5)/10;
			y[n]=cy/1000;
		}
		else if(y[n]<0)
		{
			cy=y[n]*10000;
			cy=(cy-5)/10;
			y[n]=cy/1000;
		}

		printf("%.3f %.3f\n",x[n],y[n]);
	}
	return 0;
}

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

double a, b, c, d, e, f;
int main()
{
	while(std::cin>>a>>b>>c>>d>>e>>f)
	{
		double x = (e*c-b*f)/(a*e-b*d);
		double y = (-d*c+a*f)/(a*e-b*d);
		printf("%.3f %.3fn",x+(1e-10),y+(1e-10));
	}
	return 0;
}

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

using namespace std;

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

	while(cin >> a >> b >> c >> d >> e >> f){
			delta = (a * e) - (b * d);

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

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

	return 0;
}

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

template <typename T> double round(const T r, const int n = 0){
    if(r>=0){
        return floor(r * pow(10, -n) + 0.5) * pow(10, n);
    }
    else{
        return ceil(r * pow(10, -n) - 0.5) * pow(10, n);
    }
}

int main(){
    double a, b, c, d, e, f;
	while(std::cin >> a){
		std::cin >> b >> c >> d >> e >> f;
		std::cout << std::fixed << std::setprecision(3)
			<< round((c * e - b * f) / (a * e - b * d), -3) << ' '
			<< round((a * f - c * d) / (a * e - b * d), -3) << std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int b,a,e,d,f,i,c;
	float y,x;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)  {
			y=(c*d-a*f)/(b*d-a*e);
			x=(c-(b*y))/a;
		if(x==-0.0000){
			x=0.0000;
		}
		if(y==-0.000){
			y=0.0000;
		}	
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
	double a,b,c,d,e,f,x,y,x2,y2;
	int status;
	while(1){
		status=scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f);
		if (status==EOF){
			break;
		}
		x=(f/e-c/b)/(d/e-a/b);
		y=c/b-a*x/b;
		x2=(b*f-c*e)/(b*d-a*e);
		y2=(c-a*x2)/b;
		
		if (x<0.0005 && x>-0.0005){
			x=0;
		}
		if (y<0.0005 && y>-0.0005){
			y=0;
		}
	//	printf("%.3f %.3f\n",x,y);
	//	printf("%f %f\n",x,y);
		printf("%.3f %.3f\n",x2,y2);
	//	printf("%f %f\n\n\n",x2,y2);
	}
	
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(){
	double matrix[4],ans[2];
	while(scanf("%lf %lf %lf %lf %lf %lf",&matrix[0],&matrix[1],&ans[0],&matrix[2],&matrix[3],&ans[1]) != EOF){
		double t = matrix[0]*matrix[3]-matrix[1]*matrix[2];
		printf("%.3lf %.3lf\n",matrix[3]*ans[0]/t-matrix[1]*ans[1]/t,-matrix[2]*ans[0]/t+matrix[0]*ans[1]/t);
	}
	return 0;
}

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

using namespace std;

int main()
{
	double A, B, C, D, E, F, X, Y, G , H;

	while(cin >> A >> B >> C >> D >> E >> F)
	{
		X=(double)(C*E-F*B)/(A*E-D*B);
		Y=(double)(A*F-D*C)/(A*E-D*B);

		printf("%.3f %.3f\n",X,Y);
	}
	return 0;
}

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