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<stdio.h>
#include<math.h>
double sg(double x){
	if ( x >= 0.0 ) {
		return (0.001*(floor(x + 0.0005)))*1000;
	} else {
    	return (-0.001 * floor(fabs(x) + 0.0005))*1000;
	}
}
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=sg(((c*d)-(a*f))/((b*d)-(a*e)));
		x=sg(((c*e)-(b*f))/((a*e)-(b*d)));
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

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

inline void swap(int &a, int &b) { int t = a; a = b; b = t; }

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

C++: /*
	0004:Simultaneous Equation
*/
#include	<iostream>
#include	<cstdio>

using namespace std;

int main(void) {
	while(1) {
		double a, b, p, c, d, q;
		cin >> a >> b >> p >> c >> d >> q;
		
		if( cin.eof() ) { break; }
		
		printf("%.3f %.3f\n", (d * p - b * q) /(a * d - b * c), (a * q - c * p) / (a * d - b * c));
	}
	return 0;
}

C++: #include <iostream>

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

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

int main()
{ 
	double x1, x2, y1, y2, z1, z2;
	double x, y;
	while (cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2) {
		x = x1;
		x1 *= x2; y1 *= x2; z1 *= x2;
		x2 *= x; y2 *= x; z2 *= x;
		y = (z1 - z2) / (y1 - y2);
		if (z1 - z2 == 0)y = 0;
		x = (z1 - (y1*y)) / x1;
		if (z1 - (y1*y) == 0)x = 0;
		int a, b;
		a = x * 10000;
		b = y * 10000;
		if (a % 10 > 4) {
			a += 10;
			x = double(a) / 10000;
		}
		if (b % 10 > 4) {
			b += 100;
			y = double(b) / 10000;
		}
		cout << fixed;
		cout << setprecision(3) << x << ' ' << y << endl;

	}
	return 0;
}

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

int main(){
	while(true){
		double a,b,c,d,e,f;
		cin>>a>>b>>c>>d>>e>>f;
		if(cin.fail()) break;
		cout<<showpoint<<setprecision(4)<<(c*e-b*f)/(a*e-b*d)<<" "<<(c*d-a*f)/(b*d-a*e)<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double bd = b*d;
		double ea = e*a;
		double cd = c*d;
		double fa = f*a;
		y = (cd - fa) / (bd - ea);
		x = (c - b*y) / a;
		printf("%.3f %.3f\n", x, y);
	}
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],inv[2][2],a[2],det;
  while(cin >>m[0][0]>>m[0][1]>>a[0]>>m[1][0]>>m[1][1]>>a[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;
    printf("%.3lf %.3lf\n",a[0]*inv[0][0]+a[1]*inv[0][1],a[0]*inv[1][0]+a[1]*inv[1][1]);
  }
  return 0;
}

C++: #include <bits/stdc++.h>	//C++標準ライブラリ一括読み込み
using namespace std;

// ax+by=c
// dx+ey=f
double unko(double x){
	int y=int(round(x*1000));
	return double(y/1000);
}

int main(){
    long long a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
//	long long x=(c*e-b*f)/(a*e-b*d)+0.0005;
//	long long y=(c*d-a*f)/(b*d-a*e)+0.0005;
//	printf("%.3f %.3f",x,y);
	long long x=(c*e-b*f)/(a*e-b*d);
	long long y=(c*d-a*f)/(b*d-a*e);
	printf("%.3f %.3f",unko(x),unko(y));
    return 0;
}

C++: const int tt = 10000;

#include<iostream>
#include<string>
#include<sstream>
using namespace std;

string toStr(int n);
string intToString(int n);

int main() {
  int a, b, c, d, e, f;
  
  while(cin >> a >> b >> c >> d >> e >> f) {
    c = c * tt;
    f = f * tt;

    int det = a * e - b * d;

    int x = ( e * c - b * f) / det;
    int y = (-d * c + a * f) / det;
//    cout << x << y << endl;

    cout << toStr(x) << " " << toStr(y) << endl;
  }
}

string toStr(int n) {
  string pm, val;
  
  if (n < 0) {
    pm = "-";
    n = -n;
  } else {
    pm = "";
  }

  int ipart = n / tt;
  int fpart = (n - ipart * tt) + tt + 5;

  val = pm + intToString(ipart) + "." + intToString(fpart).substr(1, 3);
  return val;
}

string intToString(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}

C++: #include <bits/stdc++.h>
using namespace std;
double a,b,c,d,e,f,y,x;

int main (){
	while(cin>>a>>b>>c>>d>>e>>f){
		y=(((c*d)-(f*a))/((b*d)-(e*a)));
		x=((ac-(b*y))/a);
		if(x==0){
			x=abs(x);
		}
		if(y==0){
			y=abs(y);
		}
		cout<<fixed<<showpoint<<setprecision(3);
		cout<<x<<" "<<y<<endl;
	}
}

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


int main(void) {
    int a, b, c, d, e, f;
    
    
    while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
        double y = (double)((d*c - a*f) / (b*d-a*e));
        double x = (double)((c - b * y) / a);
        printf("%.3f %.3f",x, y);
    }
    
    return(0);
}

C++: 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line ="";
		while((line = br.readLine())!=null){
			String[] s= line.split(" ");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			int d = Integer.parseInt(s[3]);
			int e = Integer.parseInt(s[4]);
			int f = Integer.parseInt(s[5]);
			int x = (e*c - b*f)/(a*e - b*d);
			int y = (a*f - c*d)/(a*e - b*d);
			System.out.println(x+" "+y);
		}

	}

}

C++: #include <iostream>
using namespace std;
int main(void){
    double A[2][3];
    while(cin >> A[0][0] >> A[0][1] >> A[0][2] >> A[1][0] >> A[1][1] >> A[1][2]){
        for(int i = 1; i < 3; i++){
            A[0][i] /= A[0][0];
        }
        A[0][0] /= A[0][0];
        for(int i = 1; i < 3; i++){
            A[1][i] -= A[0][i] * A[1][0];
        }
        A[1][0] -= A[0][0] * A[1][0];
        for(int i = 0; i < 3; i++){
            if(i != 1)
                A[1][i] /= A[1][1];
        }
        A[1][1] /= A[1][1];
        for(int i = 0; i < 3; i++){
            if(i != 1)
                A[0][i] -= A[1][i] * A[0][1];
        }
        A[0][1] -= A[1][1] * A[0][1];
        
        printf("%.3f %.3f\n", A[0][2], A[1][2]);
    }
}

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

#include <iostream>
#include <iomanip>

using namespace std;

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


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

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