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>
#include<stdio.h>
#include<math.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 = (c*e - b*f) / (a*e - b*d);
		y = (a*f-c*d) / (a*e - b*d);
		printf("%.3f %.3f\n", x, y);
	
	}

}

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

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    double a, b, c, d, e, f, 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);
		
		x*=1000;y*=1000;
		if(x<0){
			x-=0.5;
		}else{
			x+=0.5;
		}
		if(y<0){
			y-=0.5;
		}else{
			y+=0.5;
		}
		int xi = (int)x;
		int yi = (int)y;
		x = (double)xi;
		y = (double)yi;
		x/=1000;y/=1000;
		
		printf("%.3f %.3f\n", x, y);
	} 
	return 0;
}

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

using namespace std;

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

double round3(double dat){

	int fct;
	fct = (int)pow(10, 3);
	dat *= fct;
	dat = round(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2, a, b, c, d, e, f;

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

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

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

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);




	cout << fixed << setprecision(3) << round3(x1) << " " << round3(y1) << endl;
	cout << fixed << setprecision(3) << round3(x2) << " " << round3(y2) << endl;

	return 0;
}

double x(double a, double b, double c, double d, double e, double f) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double a , double b, double c, double d, double e, double f) {

	return (a*f - c*d) / (a*e - b*d);
}

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

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) {
    double x, y;
    double denom = a * e - b *d;
    double nomer_x = c*e - b*f;
    double nomer_y = -c*d + a*f;
    x = nomer_x / denom;
    y = nomer_y / denom;
    int f1 = 0, f2 = 0;
    if((int)x == 0) {
      printf("0.000 ");
      f1 = 1;
    }
    if(f1 == 0) {
      printf("%.3lf ", x);
    }
    if((int)y == 0) {
      printf("0.000\n");
      f2 = 1;
    }
    if(f2 == 0) {
      printf("%.3lf\n", y);
    }
  }

  return 0;
}

C++: #include<stdio.h>
void print_answer(int a,int b,int c,int d,int e,int f){
  double x,y;
  y=(c*d-f*a)/(b*d-e*a);
  x=(c-b*y)/a;
  printf("%5.3f ",x);
  printf("%5.3f\n",y);
}

int main(void){
  int n,a[2000],b[2000],c[2000],d[2000],e[2000],f[2000];
  int i=0,j;
  while(scanf("%d",&n)!=EOF){
      a[i]=n;
      scanf("%d",&n);
      b[i]=n;
      scanf("%d",&n);
      c[i]=n;
      scanf("%d",&n);
      d[i]=n;
      scanf("%d",&n);
      e[i]=n;
      scanf("%d",&n);
      f[i]=n;
      i++;
  }
  for(j=0;j<i;j++){
    print_answer(a[j],b[j],c[j],d[j],e[j],f[j]);
  }

  return(0);
}

C++: #include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	double a1, b1, c1, a2, b2, c2, A, B, C, X, Y;
	while (cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2) {
		A = a1, B = b1, C = c1;
		if (a1 != a2) {
			double tmp = a2 / a1;
			a1 *= tmp, b1 *= tmp, c1 *= tmp;
		}
		Y = (c2 - c1) / (b2 - b1);
		X = (C - B * Y) / A;
		printf("%.3f %.3f\n", X, Y);
	}
	return 0;
}

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


double a,b,c,d,e,f;
double x,y;//x,y座標
int main(){
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) !=EOF){
    

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

    if(y > 0){
      y =floor((y+0.0005)*1000)/1000;
    }
    if(y < 0){
      y =-floor((fabs(y)+0.0005)*1000)/1000;
    }
    if(x > 0){//小数第4位を四捨五入
      x =floor((x+0.0005)*1000)/1000;
    }
    if(x <0){
      x =-floor((fabs(x)+0.0005)*1000)/1000;
    }
    printf("%.3f %.3f\n",x,y);
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI 3.1415926535897
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


signed main(){
	double a, b, c, d, e, f;
	double A, B, C;
	double x, y;
	while(cin >> a >> b >> c >> d >> e >> f){
		A = (a*e) - (b*d);
		B = (c*e) - (b*f);
		C = (a*f) - (c*d);

		x = round(B/A*1000)/1000;
		y = round(C/A*1000)/1000;

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

		cout << fixed << setprecision(3) << x << ' ' << y << endl;
	}

	return 0;
}

C++: #include <stdio.h>

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

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

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

using namespace std;

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