Go: package main

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

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
                fmt.Printf("%04f %04f\n", x, y)
        }
}

C++: #include <iostream>
#include <iomanip>
#include <math.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)
	{
		G = A / D;
		D *= G;
		E *= G;
		F *= G;
		Y = (F-C) / (E-B);
		
		D /= G;
		E /= G;
		F /= G;
		H = B / E;
		D *= H;
		E *= H;
		F *= H;
		X = (F-C) / (D-A);

		X= floor(X*1000+500)/1000;
		Y= floor(Y*1000+500)/1000;

		if(Y==0){
			Y=0;
		}

		if(X==0){
			X=0;
		}

		cout<<fixed<<setprecision(3)<<X<<" "<<fixed<<setprecision(3)<<Y<<endl;
	}

	return 0;
}

C++: #include <cstdio>
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)) {
    double y = (c * d - a * f) / (b * d - a * e);
    double x = (c - b * y) / a;
    printf("%.3lf %.3lf\n", x, y);
  }
}

C++: #include <iostream>
#include <cstdio>
#define N 2
using namespace std;

class Calc{
    public:
    double A[N][N+1];
    int i, j, k;
    double tmp;
    void calcSi();
    void printSi();
};

void Calc::calcSi(){
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            tmp = A[j][i] / A[i][i];
            for(k=i+1; k<=N; k++)
                A[j][k] -= A[i][k] * tmp;
        }
    }

    for(i=N-1; i>=0; i--){
        tmp = A[i][N];
        for(j=i+1;j<N;j++)
            tmp -= A[i][j] * A[j][N];
        A[i][N] = tmp / A[i][i];
    }
}

void Calc::printSi(){
    for(i=0;i<N;i++){
        printf("%.3f",A[i][N]);
        if(i != N-1) {
            cout << " ";
        }
    }
    cout << endl;
}

int main(void){
    Calc c;
    while(cin >> c.A[0][0] >> c.A[0][1] >> c.A[0][2] >> c.A[1][0] >> c.A[1][1] >> c.A[1][2]){
        c.calcSi();
        c.printSi();
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
	double a,b,c,d,e,f;
	double x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
	x=(c*e-f*b)/(a*e-d*b);
	y=(a*f-d*c)/(a*e-b*d);
	x=x*1000;
	if(x>0) x=(double)(int)(x+0.5);
	else  x=(double)(int)(x-0.5);
	x=x/1000;
	y= y*1000;
	if(y>0) y=(double)(int)(y+0.5);
	else y=(double)(int)(y-0.5);
	y=y/1000;
	printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

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

#define EPS 1e-12

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

  while(scanf("%lf %lf %lf %lf %lf %lf",&a ,&b ,&c ,&d ,&e ,&f) != EOF){

    x=(c*e-b*f)/(a*e-b*d);
    y=(d*c-a*f)/(b*d-a*e);
    if(abs(x) < EPS) x = 0.000;
    if(abs(y) < EPS) y = 0.000;

    printf("%.3lf %.3lf\n",
	   (int)(x * 1000 + 0.5) / 1000.0, (int)(y * 1000 + 0.5) / 1000.0);
  
  }
  
  return 0;
}

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

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

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

C++: #include <algorithm>
#include <string.h>
#include <stdio.h>

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

C++: #include <bits/stdc++.h>
using namespace std;

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

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

using namespace std;

int main(){
	//Cramer's Rule
	double a, b, c, d, e, f;

	while(cin >> a >> b >> c >> d >> e>> f) {
		printf("%.3f %.3f\n", (e * c - b * f) / (a * e - b * d), (a * f - c * d) / (a * e - b * d));
	}
	return 0;
}

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

int main(void){
	int a,b,c,d,e,f;
	float x = 0, y= 0;
	//ax+by=c
    //dx+ey=f
	
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
		if(a<-1000 || b<-1000 || c<-1000 || d<-1000 || e<-1000 || f<-1000 ||
			a> 1000 || b> 1000 || c> 1000 || d> 1000 || e> 1000 || f> 1000)
			cout<<"-1000から1000までの値を入れてください."<<'\n';
		else{
			if(a*e-b*d != 0){
				x =(float)(c*e-b*f)/(float)(a*e-b*d);
				y =(float)(a*f-c*d)/(float)(a*e-b*d);
			}
			else{
				x = 0;
				y = (float)c/b;	
			}
			printf("%.3f %.3f \n",x,y);
		}
	}
	
	//終了
	return 0;
}

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

int main(){

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

	double x,y;

	while(cin>>a){
		cin>>b;
		cin>>c;
		cin>>d;
		cin>>e;
		cin>>f;

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

		if(fabs(x)<1e-3 && fabs(y)<1e-3){
			printf("%.3f %.3f\n",fabs(x),fabs(y));
		}
		else if(fabs(x)<1e-3){
			printf("%.3f %.3f\n",fabs(x),y);
		}
		else if(fabs(y)<1e-3){
			printf("%.3f %.3f\n",x,fabs(y));
		}
		else{
			printf("%.3f %.3f\n",x,y);
		}

	}

	return 0;
}

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

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

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

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

int main(){
	int i = 0;
	double a, b, c, d, e, f;
	double x[2], y[2];
	while (i<=1){
		cin >> a >> b >> c >> d >> e >> f;
		x[i] = (c*e - f*b) / (a*e - b*d);
		y[i] = (c - a*x[i])/b;
		i++;
	}
	for (int j = 0; j < 2; j++){
		cout << fixed << setprecision(3) << x[j]+0.00001 << " " << setprecision(3) << y[j] +0.00001<< '\n';
	}

	return 0;
}

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

int main()
{
	for (double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; cout << fixed << setprecision(4) << ((c*e - b*f) != 0 ? (c*e - b*f) / (a*e - b*d) +0.00005 : 0.0000) << ' ' << ((a*f - c*d) != 0 ? (a*f - c*d) / (a*e - b*d) + 0.00005 : 0.0000) << endl);
	return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	int a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


		cout << fixed << setprecision(3);
		if ((a*e - d*b) == 0)
		{
			cout << 0 << space << 0 << endl;
		}
		else
		{
			x = (e*c - b*f) / (a*e - d*b);
			y = (-d*c + a*f) / (a*e - d*b);

			
			if (x == 0)
				x = 0.0;
			if (y == 0)
				y = 0.0;

			cout << x << space << y << endl;
			
		}
		cout << dec;
	}
}