Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var strs []string
	var a, b, c, d, e, f float64
	var x, y float64
	for scanner.Scan() {
		strs = strings.Split(scanner.Text(), " ")
		_a, _ := strconv.Atoi(strs[0])
		_b, _ := strconv.Atoi(strs[1])
		_c, _ := strconv.Atoi(strs[2])
		_d, _ := strconv.Atoi(strs[3])
		_e, _ := strconv.Atoi(strs[4])
		_f, _ := strconv.Atoi(strs[5])
		a = float64(_a)
		b = float64(_b)
		c = float64(_c)
		d = float64(_d)
		e = float64(_e)
		f = float64(_f)
		y = (c*d - f*a) / (d*b - a*e)
		x = (c - b*y) / a

		fmt.Printf("%.3f %.3f\n", x, y)
	}
}

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

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

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

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

		x *= 10000;
		x = x + 0.5 - (x < 0);
		x = (int)x;
		x /= 10000;

		y *= 10000;
		y = y + 0.5 - (y < 0);
		y = (int)y;
		y /= 10000;


		cout << setprecision(4) << showpoint << x << " " << y << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
#include <cstdio>
using namespace std;
static const double EPS = 1e-9;
int main(){
	double a,b,c,d,e,f;
	while(~scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)){
		double x = (b*f-e*c)/(b*d-e*a);
		double y = (c-a*x)/b;
		printf("%.3lf %.3lf\n",x+EPS,y+EPS);
	}
}

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

C++: #include <stdio.h>
int main(){
	float a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;
	float x = 0,y = 0;

	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) != EOF){
		if(a == 0){
			a *= e / b;
			c *= e / b;
			b *= e / b;

			if((c - f) == 0 || (a - d) == 0){
				y = 0;
			}
			else{
				y = (c - f) / (a - d);
			}
			
		}
		else{
			b *= d / a;
			c *= d / a;
			a *= d / a;

			if((c - f) == 0 || (b - e) == 0){
				y = 0;
			}
			else{
				y = (c - f) / (b - e);
			}
		}

		if((c - b * y) == 0 || a == 0){
				x = 0;
		}
		else{
			x = (c - b * y) / a;
		}
	
		printf("%0.3f %0.3f\n",x,y);

	}

	return 0;
}

C++: *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
 */
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>

#define N 2
#define L N*(N+1)

using namespace	std;

int
main()
{
	string line;
	while (getline(cin, line)) {
		istringstream iss(line);
		vector <float> coef(L);
		for (int i = 0; i < L; i++)
			iss >> coef[i];
		float pivot, mul;
		for (int i = 0; i < N; i++) {
			pivot = coef[i * (N + 1) + i];
			for (int j = 0; j < N + 1; j++) {
				coef[i * (N + 1) + j] = (1 / pivot) * coef[i * (N + 1) + j];
			}
			for (int k = i + 1; k < N; k++) {
				mul = coef[k * (N + 1) + i];
				for (int l = i; l < N + 1; l++) {
					coef[k * (N + 1) + l] = coef[k * (N + 1) + l] - mul * coef[i * (N + 1) + l];
				}
			}
		}
		for (int i = N - 1; i > 0; i--) {
			for (int k = i - 1; k >= 0; k--) {
				mul = coef[k * (N + 1) + i];
				for (int l = i; l < N + 1; l++) {
					coef[k * (N + 1) + l] = coef[k * (N + 1) + l] - mul * coef[i * (N + 1) + l];
				}
			}
		}
		for (int i = 0; i < N; i++) {
			if (i > 0) cout << ' ';
			cout << fixed << setprecision(3) << coef[i * (N + 1) + N];
		}
		cout << endl;
	}
	return 0;
}

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

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;
}