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 := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

C++: #include<iostream>
int GCM(int a,int b){
	if(b==0)return a;
	return GCM(b,a%b);
}

int main(){
	int a,b,c,d,e,f;
	while(std::cin>>a>>b>>c>>d>>e>>f){
		float x=0.000f,y=0.000f;
		int a_=a,b_=b,c_=c,d_=d,e_=e,f_=f;
		b_*=GCM(a,d)/a,c_*=GCM(a,d)/a;
		e_*=GCM(a,d)/d,f_*=GCM(a,d)/d;
		y=(c_-f_)/(b_-e_);
		x=(c-y*b)/a;
		std::cout<<x<<" "<<y<<std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main(void){
	double x1[1000],y1[1000];
	int a=0,b=0,c=0,d=0,e=0,f=0,x2,y2,i=0,j;
    
    while(scanf("%d %d %d %d %d %d\n",&a,&b,&c,&d,&e,&f) != EOF)
	{
		x2 = ((c * e -b * f) / (a * e - b * d))*1000+0.5;
	    y2 = ((c - a * x2) / b)*1000+0.5;

		x1[i] = x2/1000;
		y1[i] = y2/1000;

		i+=1;
	}
	for(j=0;j<i;j++)
	{
		printf("%.3lf %.3lf\n",x1[i],y1[i]);
	}
  return 0;
}

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

int main(){
    float a,b,c,d,e,f;
    while(-1!=scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f)){
        b/=a;
        c/=a;
        e-=d*b;
        f-=d*c;
        f/=e;
        c-=b*f;

        printf("%.3f %.3f\n", c, f);
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
  int 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);
    printf("%.3f %.3f\n", x + 0.0001, y + 0.0001);
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#define swap(a,b) {a=a+b; b=a-b; a=a-b;}

void q4() {
	double a, b, c, d, e, f;
	for (;;) {
		cin >> a >> b >> c >> d >> e >> f;
		//scanf_s("%lf %lf %lf %lf %lf %lf\n", &a, &b, &c, &d, &e, &f);

		if (a == 0) {
			swap(a, d);
			swap(b, e);
			swap(c, f);
		}
		b /= a;
		c /= a;
		a = 1;

		e -= b * d;
		f -= c * d;
		d = 0;

		f = f / e;
		e = 1;
		
		c -= f * b;
		b = 0;

		printf("%4lf %4lf\n", c, f);
	}
}

int main() {
	q4();
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <queue>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <functional>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iterator>
#include <algorithm>
#include <iostream>

#define aLL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXISt(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define MAX 100000000
#define PI 3.14159265258979
#define pb push_back
#define mp make_pair
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

int sttoi(std::string str) {
	int ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

int gcd(int a, int b){
	if (b > a)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a%b);
}

void solve() {
	int a, b, c, d, e, f;
	double x, y;
	while (scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != -1){
	y = (double)(d*c - a*f) / (double)(b*d - a*e);
	x = (double)(c - b*y) / (double)a;
	x *= 1000;
	y *= 1000;
	x = round(x);
	y = round(y);
	x /= 1000;
	y /= 1000;
	cout << setprecision(8) << fixed << x << " " << y << endl;
	}
}

int main() {
	solve();
	return 0;
}

C++: #include<stdio.h>
int main(void){

	double a, b, c, d, e, f;
	double A,B;
	double x, y;

	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		 
	 
	 if ( (a > 0 && d < 0)|| (a > 0 && d > 0)) {
		A = c*d - f*a;
		B = b*d - e*a;
        y = A / B;
    }
    
    else if ((a < 0 && d > 0) || (a < 0 && d < 0)) {
		A = c*d + f*a;
		B = b*d + e*a;
        y = A / B;
    }
	
    x = (c - y * b) / a;
	printf("%.3lf %.3lf\n" ,x , y);
	}
	return 0;

}

C++: #include <cstdio>

int main() {
	using namespace std;
	for (;;) {
		double a, b, c, d, e, f;
		if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) { break; }

		double detA = (double)(a * e - b * d);
		if (detA == 0) { break; }
		double x = (double)(e * c - b * f) / detA;
		if (x <= 0 && x > -5e-4) { x = 0; }
		double y = (double)(-d * c + a * f) / detA;
		if (y <= 0 && y > -5e-4) { y = 0; }
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void) {
	int a, b, c, d, e, f;
	cout << fixed << setprecision(3);
	while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
		double x = (double)(c * e - f * b) / (a * e - d * b);
		if (abs(x) < 0.001) x = 0;
		double y = (c - a * x) / b;
		cout << x << " " << y << endl;
	}
}

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 << 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<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){

	float a, b, c, d, e, f;
	float ansx[MAX], ansy[MAX];

	int i = 0;

	while (scanf("%f%f%f%f%f%f%f", &a,&b,&c,&d,&e,&f) != EOF){
		if (a*e != b*d){
			ansx[i] = (c*e - b*f) / (a*e - b*d);
			ansy[i] = (c*d - a*f) / (b*d - a*e);
			if (((int)(ansx[i] * 10000) % 10) > 4 || ((int)(ansx[i] * 10000) % 10) < -4){
				ansx[i] += 0.001;
			}
			if (((int)(ansy[i] * 10000) % 10) > 4 || ((int)(ansx[i] * 10000) % 10) < -4){
				ansy[i] += 0.001;
			}
		}
		i++;
	}

	if (i == 0)printf("\n");

	for (int j = 0; j < i; j++){
		printf("%.3f %.3f\n", ansx[j], ansy[j]);
	}
	
	return 0;
}

C++: #include<cstdio>
double a,b,c,d,e,f;
void C(double *p,double *q)
{
    double t=*p;
    *p=*q;
    *q=t;
}
int main()
{
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)==6)
    {
        if(a==0)
        {
            C(&a,&d);
            C(&b,&e);
            C(&c,&f);
        }
        double x,y=(f-d*c/a)/(e-b*d/a);
        x=c/a-b*y/a;
        printf("%.3lf %.3lf\n",x,y);
    }
    return 0;
}