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 <iomanip>
using namespace std;

void OutputSolution(int a, int b, int c, int d, int e, int f)
{
    long long double x, y;
	if(b == 0){
		x = c / a;
		y = (f-d*x) / e;
	}else{
		int B = b;
		a *= e;
		b *= e;
		c *= e;
		d *= B;
		e *= B;
		f *= B;
		x = (c-f) / (a-d);
		y = (c-a*x) / b;
	}
	cout << fixed << setprecision(3) << x << ' ' << y << endl;
}

int main()
{
	while(true){
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()) break;
		OutputSolution(a, b, c, d, e, f);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],ans[2],inv[2][2],x,y,det;
  while(cin >>m[0][0]>>m[0][1]>>ans[0]>>m[1][0]>>m[1][1]>>ans[1]){
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    x = ans[0]*inv[0][0]+ans[1]*inv[0][1];
    y = ans[0]*inv[1][0]+ans[1]*inv[1][1];
    printf("%.3lf %.3lf\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 M[2][3] = { 
            {a, b, c},
            {d, e, f}
        };
        double d = 0, m = 0;
        for(int i=0; i<2; ++i)
        {  
            d = M[i][i];
            for(int j=0; j<3; ++j){
                M[i][j] = M[i][j] / d;
            }
            for(int k = i+1; k<2; k++){
                m = M[k][i];
                for(int n = i; n<3; ++n){
                    M[k][n] = M[k][n] - m * M[i][n];
                }
            }
        }
        
        for(int i = 1; i>0; --i){
            for(int j= i-1; j>=0; --j){
                d = M[j][i];
                for(int n=i; n<3; ++n){
                    M[j][n] = M[j][n] - d * M[i][n];
                }
            }
        }
        for(int i=0; i<2; i++){
            if(i == 1) {
                printf("%.3lf\n", M[i][2]); break;
            }
            printf("%.3lf ", M[i][2]);
            
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

C++: #include<stdio.h>
#define rep(i,m,n) for(i = m;i < n;i++)
int main(){
	int a[6],i;
	int kcor = 0;
	double kx[1000] = {0},ky[1000] = {0};
	while(scanf("%d",a)!=-1){
		rep(i,1,6)
			scanf("%d",a+i);
		int det;
		det = a[0]*a[4]-a[1]*a[3];
		kx[kcor] = (a[4]*a[2]-a[1]*a[5])/(double)det;
		ky[kcor] = (-a[3]*a[2]+a[0]*a[5])/(double)det;
		kcor++;
	}
	rep(i,0,kcor){
		printf("%.3lf %.3lf\n",kx[i],ky[i]);
		//printf("%lf %lf\n",kx[i],ky[i]);
	}
	return 0;
}

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

int main(){
    int a[100]={0};
    int b[100]={0};
    int c[100]={0};
    int d[100]={0};
    int e[100]={0};
    int f[100]={0};
    int i=0;
    while(cin>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i]){
        i++;
        }
    for(int j=0;j<i;j++){
        float x=(b[j]*f[j]-e[j]*c[j])/(b[j]*d[j]-a[j]*e[j]);
        float y=(a[j]*f[j]-c[j]*d[j])/(a[j]*e[j]-b[j]*d[j]);
        cout<<setiosflags(ios::fixed)<<setprecision(3)<<x<<" "<<y<<endl;
        }
    
    return 0;
}

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

using namespace std;

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

    while (cin >> a >> b >> c >> d >> e >> f) {
        answer1 = static_cast<double>(e * c - b * f) / (a * e - b * d);
        answer2 = static_cast<double>(-d * c + a * f) / (a * e - b * d);
        if (answer1 == 0) answer1 = 0.000;
        if (answer2 == 0) answer2 = 0.000;
        cout << fixed << setprecision(3) << round(answer1) << " " << round(answer2) << endl;
    }
    
    return 0;
}

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

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

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

  m = a;
  n = d; 

  a *= n;
  b *= n;
  c *= n;

  d *= m;
  e *= m;
  f *= m;
  
  y = (double)((c-f)/(b-e));

  x = (double)((c-b*y)/a);

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

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

  return 0;
}

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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()

int main() {
    double a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d>>e>>f) {
        double x = (e*c-b*f)/(a*e-b*d);
        double y = (a*f-d*c)/(a*e-b*d);
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
    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){   
  y = (f-(d*c)/a)/(e-(d*b)/a);
  x = (c-b*y)/a;
  cout << fixed << setprecision(3) << x << " " << y << endl;
  }
  // cin >> a >> b >> c >> d >> e >> f;   
  // y = (f-(d*c)/a)/(e-(d*b)/a);
  // x = (c-b*y)/a;

  // cout << fixed << setprecision(3) << x << " " << y << endl;
    
    
    
  return 0;

}

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


double a,b,c,d,e,f;
double A,B,C,D;
int main(){
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) !=EOF){
    if(a == 0){
      A =c/b;
      B = (f-e*A)/d;
      }
    if(b == 0){
      B = c/a;
      A = (f-d*B)/e;
    }
    if(d == 0){
      A =f/e;
      B = (c-b*A)/a;
    }
    if(e == 0){
      B =f/c;
      A =(c -a*B)/b;
    }
    if( a != 0&& b!=0&& d!=0 &&e!=0){
      b/=a;
      c/=a;
      a/=a;
      
      e/=d;
      f/=d;
      d/=d;
      A =(c-f)/(b-e);
      B =(c-b*A);
    }
    
    A =floor((A+0.0005)*1000)/1000;//小数第4位を四捨五入
    B =floor((B+0.0005)*1000)/1000;
    printf("%.3f %.3f\n",B,A);
  }
  return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <vector>
using namespace std;

int main(int argc, char const *argv[]) {
  double x, y;
  double a, b, c, d, e, f;
  while (!(cin >> a >> b >> c >> e >> f >> d).eof()) {
    x = (f * c - b * d) / (a * f - b * e);
    y = (a * d - c * e) / (a * f - b * e);
    std::cout << fixed << setprecision(3) << x << " " << y << '\n';
  }
  return 0;
}