Go: package main

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

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                if x == 0.0 {
                        x = math.Abs(x)
                }
                if y == 0.0 {
                        y = math.Abs(y)
                }
                fmt.Printf("%.3f %.3f\n", x, y)
        }
}

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

using namespace std;


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

	while(scanf("%lld %lld %lld %lld %lld %lld",&a,&b,&c,&d,&e,&f)!=EOF){
		if(c*e==b*f){
			x=0;
		}else{
			pre_x=(10000*(c*e-b*f))/(a*e-d*b);

			if(pre_x>0 && ((pre_x%10) >= 5)){
				pre_x += (10-(pre_x%10));
			}else if(pre_x < 0 && ((pre_x%10) <= -5)){
				pre_x -= (10+(pre_x%10));
			}
			x = pre_x/10000;
			if(x < 0.001 && x > -0.001)x=0;
		}

		if(a*f==c*d){
			y=0;
		}else{
			pre_y=(10000*(a*f-c*d))/(a*e-b*d);
			if(pre_y>0 && ((pre_y%10) >= 5)){
				pre_y += (10-(pre_y%10));
			}else if(pre_y < 0 && ((pre_y%10) <= -5)){
				pre_y -= (10+(pre_y%10));
			}
			y = pre_y/10000;
			if(y < 0.001 && y > -0.001)y=0;
		}

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

    return 0;
}

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

using namespace std;

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

int main(){
	while(cin >> a >> b >> c >> d >> e >> f){
		printf("%8.3lf ",(c/a)-((b*c*d-a*b*f)/(a*b*d-a*a*e)));

		printf("%8.3lf\n",(c*d-a*f)/(b*d-a*e));
	}
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

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

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

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

	while (1) {
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof()) break;

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

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

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

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

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

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

#define ROUND_RANK 4

//ax+by=c
//dx+ey=f

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& q2, const double& p11, const double& q1, const double& p21) {
	return ((q2*p11 - p21*q1) / det);
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	double	a, b, c, d, e, f;//データセット
	double  det;//行列式
	double	x, y;//解
	while (std::cin >> a >> b >> c >> d >> e >> f) {
		det = Calc_det(a, b, d, e);
		det = fabs(det);
		x = Calc_x(det, c, e, b, f);
		y = Calc_y(det, a, f, c, d);
		x = Round(x, ROUND_RANK);
		y = Round(y, ROUND_RANK);
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x << " " << y;
	}	
}

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

	return 0;
}

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

C++: ///
// File:  0004.cpp
// Author: ymiyamoto
//
// Created on Wed Nov  8 21:45:53 2017
//

#include <cstdint>
#include <iomanip>
#include <iostream>

using namespace std;

int32_t main()
{
  while (true) {
    double a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    if (cin.eof()) break;

    double x = (e * c - b * f) / (a * e - b * d);
    double y = (a * f - d * c) / (a * e - b * d);
    cout << fixed;
    cout << setprecision(2) << x << " " << y << endl;
  }

  return 0;
}

C++: #include <cstdio>
using namespace std;
int main()
{
	int a, b, c, d, e, f;
	while (scanf("%d%d%d%d%d%d", &a,&b,&c,&d,&e,&f) != EOF) {
		double x, y;
		if (a != 0 && d != 0) {
			y = ((double)c / a - (double)f / d) / ((double)b / a - (double)e / d);
			x = (double)c / a - y * (double)b / a;
		}
		else if (b != 0 && e != 0) {
			x = ((double)c / b - (double)f / e) / ((double)a / b - (double)d / e);
			y = (double)c / b - x * (double)a / b;
		}
		else if (a == 0) {
			y = (double)c / b;
			x = (f - e * y) / (double)d;
		}
		else if (d == 0) {
			y = (double)f / e;
			x = (c - b * y) / (double)a;
		}
		else if (b == 0) {
			x = (double)c / a;
			y = (f - d * x) / (double)e;
		}
		else if (e == 0) {
			x = (double)f / d;
			y = (c - a * x) / (double)b;
		}
		printf("%.3f %.3f\n", x, y);
	}
	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[0]*ans[1]/t-matrix[2]*ans[0]/t);
	}
	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){

	float a,b,c,d,e,f,g;
	while(cin>> a>> b>> c>> d>> e>> f){
		float x = (1.0/(a*e-b*d)) * (e*c - b*f);
		float y = (1.0/(a*e-b*d)) * (-c*d + a*f);
		printf("%.3f %.3f",x, y);
		printf("\n");
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

using namespace std;

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

		

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