Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func mathRound(f float64) float64 {
	return math.Floor(f + .5)
}

func round(x float64) float64 {
	if math.Abs(x) < 0.001 {
		return 0
	}
	return mathRound(x*1000) / 1000
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		a, err := nextFloat64()
		if err != nil {
			break
		}
		b, _ := nextFloat64()
		c, _ := nextFloat64()
		d, _ := nextFloat64()
		e, _ := nextFloat64()
		f, _ := nextFloat64()

		detA := a*e - b*d
		x := (c*e - b*f) / detA
		y := (a*f - c*d) / detA

		fmt.Printf("%.3f %.3f\n", round(x), round(y))
	}
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;


int main(){
	double a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		double x,y;
		x=(c*e-b*f)/(e*a-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		//if(x == -0) x=0;
		//if(y == -0) y=0;

		printf("%.3f %.3f\n",x,y);
		//cout << setprecision(3)  << x << " " << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
int main(void)
{
    double a,b,c,d,e,f;
    double x,y;
    std::cout << std::showpoint << std::setprecision(4);
    while(std::cin >> a >> b >> c >> d >> e >> f){
        x = (c * e - b * f) / (a * e - b * d) * 1000;
        x = (int)(x + (x >= 0 ? 0.5 : -0.5)) / 1000.0;
        y = (f * a - c * d) / (a * e - b * d) * 1000;
        y = (int)(y + (y >= 0 ? 0.5 : -0.5)) / 1000.0;
        std::cout << x << " " << y << std::endl;
    }
    return 0;
}

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;
}