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

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

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

#define EPS 1e-9

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    double a, b, c, d, e, f;
    while(std::cin >> a >> b >> c >> d >> e >> f){
        double x = std::round(1000*(c*e-b*f)/(a*e-b*d))/1000;
        double y = std::round(1000*(a*f-c*d)/(a*e-b*d))/1000;
        std::cout << std::fixed << std::setprecision(3) << ((std::fabs(x)<EPS)?0:x) << " " << ((std::fabs(y)<EPS)?0:y) << "\n";
    }
    
    return 0;
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	while(1){
		double a,b,c,d,e,f;
		std::cin>>a>>b>>c>>d>>e>>f;
		double b2=b*gcd(a,d)/a;
		double e2=e*gcd(a,d)/d;
		double c2=c*gcd(a,d)/a;
		double f2=f*gcd(a,d)/d;
		double y=(f2-c2)/(e2-b2);
		double x=(e-b*y)/a;
		std::cout<<x<<" "<<y<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    double a,b,c,d,e,f;
    
    while(cin>>a){
        cin>>b>>c>>d>>e>>f;
        double h=a*e-b*d;
        double xx=(c*e-f*b);
        double yy=(a*f-c*d);
        
        //double ue=a*c+b*f;
        //double st=d*c+e*f;
        
        double x=xx/h;
        double y=yy/h;
        printf("%.3f %.3f \n",x,y);
       
    }
return 0;
}

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

using namespace std;

// a = 1のとき
// x = c - by
// d(c-by)*ey=f
// y = (f - dc) / (e - db)

double func1(double y1, double r1, double x2, double y2, double r2) {
	double temp1 = x2 * y1;
	double temp2 = x2 * r1;
	return (r2 - temp2) / (y2 - temp1);
}

int main() {

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

	double x = 0.0, y = 0.0;

	// double型は等価比較してはいけないといわれるが、
	// 一度も計算していないためこのケースは問題なし
	if (a == 1.0) {
		y = func1(b, c, d, e, f);
		x = c - b * y;
	}
	else if (d == 1.0) {
		y = func1(e, f, a, b, c);
		x = f - e * y;
	}
	else if (b == 1.0) {
		x = func1(a, c, e, d, f);
		y = c - a * x;
	}
	else if (e == 1.0) {
		x = func1(d, f, b, a, c);
		y = f - d * x;
	}
	else {
		// aが1となるように計算
		double a_1 = 1.0, b_1 = b / a, c_1 = c / a;
		y = func1(b_1, c_1, d, e, f);
		x = c_1 - b_1 * y;
	}

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

	return 0;
}

C++: #include <stdio.h>

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

	while(1){
		if(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != 6){
			break;
		}

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

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

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

	return 0;
}

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

    while (scanf ("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)==6)
    {
        y=(f*a-d*c)/((a*e-b*d)*1.0);
        x=(c-b*y)/a;

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

	return (0);
}

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

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

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

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

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

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

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

int main(int argc, char const* argv[])
{
	double a, b, c, d, e, f;
	const unsigned precision{3};
	std::cout << std::fixed << std::setprecision(precision);

	std::cin >> a >> b >> c >> d >> e >> f;
	while (!std::cin.eof()) {
		auto x = ( e*c - b*f )/( e*a - d*b );
		auto y = ( d*c - a*f )/( d*b - e*a );
		x = (std::abs(x) < 0.5 / std::pow(10,precision)) ? 0.0 : x;
		y = (std::abs(y) < 0.5 / std::pow(10,precision)) ? 0.0 : y;
		std::cout << x << ' ' << y << std::endl;
		std::cin >> a >> b >> c >> d >> e >> f;
	}
	return 0;
}

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

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

int main(void){
	//cin>>a>>b>>c>>d>>e>>f;
	while(cin>>a>>b>>c>>d>>e>>f){
		double x,y;
		/*
		ax+by=c;
		dx+ey=f;
		ax=c-by;
		x=(c-by)/a;
		d(c-by)/a+ey=f;
		dc/a-dby/a+ey=f;
		-dby/a+ey=f-dc/a;
		(e-db/a)y=f-dc/a;
		y=(f-dc/a)/(e-db/a);
		y=(fa-dc)/(ae-db)
		x=(c-by)/a;
		*/
		y=(f*a-d*c)/(a*e-d*b);
		x=(c-b*y)/a;
		cout<<fixed<<setprecision(3);
		cout<<x<<" "<<y<<endl;
	}
		//cin>>a;
}

C++: #include<iostream>

using namespace std;

int main()
{
	while(1){
		int a[6];
		double detA;
		double ansx, ansy;
		
		for(int i = 0; i < 6; i++){
			cin >> a[i];
			if(a[i] == EOF){
				exit(0);
			}
		}
		
		detA = ((a[0]*a[4])-(a[1]*a[3]));
		
		ansx = ((a[2]*a[4])-(a[1]*a[5]))/detA;
		ansy = ((a[0]*a[5])-(a[2]*a[3]))/detA;
		
		if(ansx == 0){
			ansx = 0;
		}
		if(ansy == 0){
			ansy = 0;
		}
		
		printf("%.4lf %.4lf\n",ansx,ansy);
	}
}

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

int main() {
	int a, b, c, d, e, f; double xNum, xDen, yNum, yDen;
	while (cin >> a >> b >> c >> d >> e >> f) {
		xNum = c * e - b * f; xDen = a * e - b * d;
		yNum = a * f - c * d; yDen = a * e - b * d;
		cout << fixed << setprecision(3)
			<< xNum / xDen + 1e-9 << " " << yNum / yDen + 1e-9 << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main(void){
    float a,b,c,d,s,t;
    while(~scanf("%f%f%f%f%f%f",&a,&b,&s,&c,&d,&t)){
        printf("%f %f\n",s*d-b*t/a*d-b*c,a*t-s*c/a*d-b*c);
    }
    return 0;
}