Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

C++: #include <iostream>
#include "stdio.h"

using namespace std;

int main(){
	double a,b,c,d,e,f;
	while(cin.eof()==false){
//		break;
	a=10000;
	cin >> a >> b >> c >> d >> e >> f;
	if (a==10000){
		break;
	}

	double under = a*e-b*d;
//	cout << (c*e-b*f)/under << " " << (a*f-c*d)/under << endl;
	printf("%.3f %.3f\n",(c*e-b*f)/under,(a*f-c*d)/under);
	}
}

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)
	{
		x=(b*f-c*e)/(b*d-a*e);
		y=(a*f-c*d)/(a*e-b*d);
		if(x*10000%10>=5) x=x+0.001; 
		if(y*10000%10>=5) y=y+0.001; 
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

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

int main(int argc, char **argv){
	//std::ifstream ifs("test.txt");
	double a = 0;
	double b = 0;
	double c = 0;
	double d = 0;
	double e = 0;
	double f = 0;

	while(std::cin >> a >> b >> c >> d >> e >> f){
	//while(ifs >> a >> b >> c >> d >> e >> f){
		double det = a * e - b * d;
		double x = (c * e - b * f) / det;
		double y = (a * f - c * d) / det;
		
		x = std::round(x * 1000) / 1000.0;
		y = std::round(y * 1000) / 1000.0;

		if(x == - 0){ x = 0; }
		if(y == - 0){ y = 0; }
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}
	return 0;
}

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

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

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

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
double a,b,c,d,e,f;
double x,y;
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;

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>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;

int dp[50][3001];
const int mod=100000;

int main(){
	double n[6];
	while(cin>>n[0]>>n[1]>>n[2]>>n[3]>>n[4]>>n[5]){
		double tmp[6];
		for(int i=0; i<6; ++i){
			tmp[i]=n[i];
		}

		double p=n[1]/n[4];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*p;
		double x=(tmp[2]-tmp[5])/(tmp[0]-tmp[3]);
		
		double q=n[0]/n[3];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*q;
		double y=(tmp[2]-tmp[5])/(tmp[1]-tmp[4]);

		printf("%.3f %.3f\n",x,y);
		//cout << setprecision(3)  << x << " " << y << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

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

C++: import sys
 
for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
 
    x = (c * e - b * f)/(a * e - b * d)
    y = (a * f - c * d)/(a * e - b * d)
    print '%f %f' % (x, y)

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

using namespace std;
 
#define N 2

int main(void)
{
	double a[N][N+1];
	int i, j, k;
	for( i=0; i<N; i++ ){
		for( j=0; j<N+1; j++ ){
			cin >> a[i][j];
		}
	}

	double p, d;
	for( k=0; k<N; k++ ){
		p = a[k][k];
		for( i=0; i<N+1; i++ )
			a[k][i] /= p;
		for( i=0; i<N; i++ ){
			if( i != k ){
				d = a[i][k];
				for( j=0; j<N+1; j++ ){
					a[i][j] -= a[k][j]*d;
				}
			}
		}
	}

	cout << setprecision(3) << setiosflags(ios::fixed);
	cout << a[0][N] << " " << a[1][N] << endl;

	return 0;
}

C++: #include <iostream>

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

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

int main()
{
	std::vector<double> x, y;
	double a, b, c, d, p, q;
	while (scanf("%d %d %d %d %d %d", &a, &b, &p, &c, &d, &q) != EOF)
	{
		x.push_back((d*p - b*q) / (a*d - b*c));
		y.push_back((a*q - c*p) / (a*d - b*c));
	}
	
	for (int i = 0; i < x.size(); ++i)
		std::cout << roundf(x[i]+0.00005) << " " << roundf(y[i]+ 0.00005) << std::endl;
	return 0;
}

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

#define ROUND_RANK 4

//ax+by=c
//dx+ey=f

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& q2, const double& p11, const double& q1, const double& p21) {
	return ((q2*p11 - p21*q1) / det);
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	double	a, b, c, d, e, f;//データセット
	double  det;//行列式
	double	x, y;//解
	std::cin >> a >> b >> c >> d >> e >> f;
	det = Calc_det(a, b, d, e);
	det = fabs(det);
	x = Calc_x(det, c, e, b, f);
	y = Calc_y(det, a, f, c, d);
	x = Round(x, ROUND_RANK);
	y = Round(y, ROUND_RANK);
	std::cout << std::fixed;
	std::cout << std::setprecision(3) << x << " ";
	std::cout << std::setprecision(3) << y << std::endl;
}