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
		if bE==0{
		    bE=1
		}
		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>
#include <vector>
using namespace std;
int main() {
 int i;
 double a,b,c,d,e,f;
 vector<double> x,y;
 while(cin >> a >> b >> c >> d >> e >> f) {
	 if (a==0 && e==0) {y.push_back(c/b); x.push_back(f/d); continue; }
	 if (b==0 && d==0) {x.push_back(c/a); y.push_back(f/e); continue; }
	 if (d==0 || e==0) {swap(a,d); swap(b,e); swap(c,f); }
	 y.push_back((c-f*a/d)/(b-e*a/d));
	 x.push_back((c-f*b/e)/(a-d*b/e));
	 }
 for (i=0;i<x.size();i++) printf("%.3f %.3f\n",x[i],y[i]); 
 return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
  double a,b,c,d,e,f;
  while( cin >> a >> b >> c >> d >> e >> f ){
    double x = (c/b - f/e) / (a/b - d/e);
    double y = (c - a*x) / b;
    if(x == -0) x = 0;
    if(y == -0) y = 0;
    printf("%.3lf %.3lf\n", x, y);
  }
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void){
	double in;
	while(cin >> in){
		double a,b,c,d,p,q;
		double delta;
		double x,y;
		a = in;
		cin >> b;
		cin >> p;
		cin >> c;
		cin >> d;
		cin >> q;
		delta = a*d-b*c;
		x = (d*p-b*q)/delta;
		y = (-c*p+a*q)/delta;
		cout << showpoint << setprecision(4);//小数点以下3桁
		cout << round(x*1000)/1000 << " " << round(y*1000)/1000 << "\n";
	}
	return 0;
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  double a,b,c,d,e,f,x,y;

  while(cin >> a >> b >> c >> d >> e >> f){
    y = (c*d-a*f)/(b*d-a*e);
    x = (c-b*y)/a;
  }
  

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

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

using namespace std;

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

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

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

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

return 0;
}

C++: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                double x, y;
                double[] h = new double[6];
                String str = Console.ReadLine();
                if (str == null) break;
                string[] s = str.Split();
                for (int i = 0; i < 6; i++)
                {
                    h[i] = double.Parse(s[i]);

                    x = ((h[2] * h[4]) - (h[1] * h[5])) / ((h[0] * h[4]) - (h[1] * h[3]));
                    y = ((h[2] * h[3]) - (h[0] * h[5])) / ((h[3] * h[1]) - (h[0] * h[4]));
                    x = Math.Floor(x * 1000) / 1000;
                    y = Math.Floor(y * 1000) / 1000;
                    Console.WriteLine("{0:0.000} {1:0.000}", x, y);

                }
            }
        }
    }

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

int main()
{
	int a,b,c,d,e,f;
	double def;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a, &b, &c, &d, &e, &f) != EOF){
		if((a * e - b * d) != 0){
			def = 1 / (double)(a * e - b * d);
		}else{
			printf("NA\n");
			continue;
		}
		x = def * (double)(e * c - b * f);
		y = def * (double)(a * f - d * c);
		if(abs(x) < 0.0005){
			x = 0.000;
		}
		if(abs(y) < 0.0005){
			y = 0.000;
		}
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <algorithm>
#include <string.h>
#include <stdio.h>

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

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

int main()
{
	int 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);
		cout << fixed
			<< setprecision(3)
			<< x<<y<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
    double a,b,c,d,e,f;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> f;
    double det = a*e-b*d;
    double ans1 = (c*e-b*f)/det;
    if(ans1<0.0)ans1 = -ans1;
    double ans2 = (-c*d+a*f)/det;
    if(ans2<0.0)ans2 = -ans2;
    printf("%1.3f %1.3f\n",ans1,ans2);
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double a[2][3];
  bool f=0;
  while(cin>>a[0][0]>>a[0][1]>>a[0][2]>>a[1][0]>>a[1][1]>>a[1][2]){
    if(a[0][0]==0)
      for(int i=0;i<3;i++)swap(a[0][i],a[1][i]),f=1;
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++)
	a[i][j]/=a[i][i];
      a[i][i]=1;
      for(int j=0;j<2;j++){
	if(j==i)continue;
	double t=a[j][i];
	for(int k=i;k<3;k++)
	  a[j][k]-=t*a[i][k];
      }
    }
    if(f)printf("%f %f\n",a[1][2],a[0][2]);
    else printf("%f %f\n",a[0][2],a[1][2]);
  }
  return 0;
}

C++: #include<cstdio>

int a,b,c,d,e,f;
double x,y;

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

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

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

C++: #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <vector>
using namespace std;

int main(int argc, char const *argv[]) {
  double x, y;
  double a, b, c, d, e, f;
  while (!(cin >> a >> b >> c >> d >> e >> f).eof()) {
    x = (f * c - b * d) / (a * f - b * e);
    y = (a * d - c * e) / (a * f - b * e);
    std::cout << fixed << setprecision(3) << x << " " << y << '\n';
  }
  return 0;
}

C++: #include <iostream>

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 = (c*d - a*f) / (b*d - a*f);

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