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 := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
#include <bits/stdc++.h>
using namespace std;

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

  scanf("%lf %lf %lf %lf %lf %lf", &a,&b,&c,&d,&e,&f);

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

  cout<<fixed; // ?°???°?????\??????????????????????????????????????????????????°???????????°??????????????????
  cout<<setprecision(3)<<fabs(x)<<" "<<fabs(y)<<endl;
  return EXIT_SUCCESS;
}

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

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

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

using namespace std;

/*
aX+bY=c
dX+eY=f
*/

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (double)(f - (double)e*c/b) / (d - (double)e*a/b);
	double y = ((double)c - a*x) / b;
	printf("%4.3f %4.3f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
  double a,b,c,d,e,f,x,y;
  while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
    x = (a*f - c*d)/(a*e - d*b);
    y = (c -b*y)/a;
    printf("%.3f %.3f",x,y);
  }
}

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

using namespace std;

int main() {

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

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

	return 0;

}

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

typedef pair<double,double> P;

P solve(double a, double b, double p, double c, double d, double q){
  P res;
  double tmp = a * d - b * c;
  res.first = (p * d - b * q) / tmp;
  res.second = (a * q - p * c) / tmp;
  return res;
}

double myRound(double x){
  int y = (int)round(x * 1000);
  return y / 1000.0;
}

int main(){
  double a, b, p, c, d, q;

  while(cin >> a >> b >> p >> c >> d >> q){
    double tmp = a * d - b * c;
    double x = (d * p - b * q) / tmp;
    double y = (a * q - c * p) / tmp;

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

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

struct Dataset{
	double a, b, c, d, e, f;
	double x, y;
	struct Dataset* next;
};

int main(){
	double a, b, c, d, e, f;
	struct Dataset *datalist, *p;

	datalist = (struct Dataset*)malloc(sizeof(struct Dataset));
	datalist->next = NULL;

	p = datalist;

	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		p->next = (struct Dataset*)malloc(sizeof(struct Dataset));
		p->next->next = NULL;
		p = p->next;
		p->a = a; p->b = b; p->c = c; p->d = d; p->e = e; p->f = f;
		if(a != 0){
			p->y = (a*f-c*d)/(a*e-b*d);
			p->x = c - b*p->y;
		}
		else{
			p->y = c/b;
			p->x = f/d - e*p->y/d;
		}
	}

	p = datalist;

	while(p->next != NULL){
		printf("%.3f %.3f\n", p->next->x, p->next->y);
		p = p->next;
	}

	return 0;
}

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

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

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

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

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

using namespace std;

double det(int a, int b, int c, int d) {
  return a * d - b * c;
}

int main() {
  int a, b, c, d, e, f;
  while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) == 6) {
    double x = det(c, b, f, e) / det(a, b, d, e),
           y = det(a, c, d, f) / det(a, b, d, e);
    if (x <= 0.0 && x >= -0.0009) x = 0.0;
    if (y <= 0.0 && y >= -0.0009) y = 0.0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

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

using namespace std;

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


double x(double, double, double, double, double, double) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double, double, double, double, double, double) {

	return (a*f - c*d) / (a*e - b*d);
}

double round3(double dat){

	int fct;
	fct = (int)pow(10, 3);
	dat *= fct;
	dat = round(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2;
	cin >> a >> b >> c >> d >> e >> f;

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

	cin >> a >> b >> c >> d >> e >> f;

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);

	cout << fixed << setprecision(3) << round3(x1) << " " << round3(y1) << endl;
	cout << fixed << setprecision(3) << round3(x2) << " " << round3(y2) << endl;

	return 0;
}

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

int gcd(int a,int b){
	if(a<b)b%=a;
	if(b==0)return a;
	int c=b;b=a%b;a=c;
	return gcd(a,b);
}

int lcm(int a,int b){
	int c=gcd(a,b);
	return c*(a/c)*(b/c);
}

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

C++: /* -*- coding:utf-8 -*- */

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>

using namespace std;

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


  while(cin >> a >> b >> c >> d >> e >> f, !cin.eof()) {
    cout << "\n";
    double x,y;
    x = (e*c-b*f)/(a*e-b*d);
    y = (-c*d+a*f)/(a*e-b*d);
    cout << x << ' ' << y << endl;
    cout << fixed << setprecision(3) << showpoint << ((fabs(x) == 0.) ? 0. : x) << ' ' << ((fabs(y) == 0.) ? 0. : y) << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    double a, b, c, d, e, f;
    while(true) {
        cin >> a;
        if(cin.eof()) break;
        cin >> b >> c >> d >> e >> f;
        double det = a * e - b * d;
        if(det == 0.0) break;
        cout << fixed << setprecision(3);
        cout << ((e*c/det-b*f/det)) << " " << ((-d*c/det+a*f/det)) << endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l;
    double a,b,c,d,e,f;
    double sum,x,y,x1,x2,y2,y1;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF)
    {
       x1=(c*e)-(b*f);
       x2=(e*a)-(b*d);
       y1=(d*c)-(f*a);
        y2=(d*b)-(a*e);
       x=x1/x2;
       y=y1/y2;
       if(x==0)
       {
           x=0;
           printf("%.3lf %.3lf\n",x,y);
       }
       else
       {
             printf("%.3lf %.3lf\n",x,y);
       }
}
       return 0;
}