Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.ParseFloat(s[0], 64)
		b, _ := strconv.ParseFloat(s[1], 64)
		c, _ := strconv.ParseFloat(s[2], 64)
		d, _ := strconv.ParseFloat(s[3], 64)
		e, _ := strconv.ParseFloat(s[4], 64)
		f, _ := strconv.ParseFloat(s[5], 64)
		x := ((b * f) - (c * e)) / ((b * d) - (a * e))
		y := ((a * f) - (c * d)) / ((a * e) - (b * d))
		if x == 0 {
			fmt.Printf("0.000 %.3f\n", y)
		} else if y == 0 {
			fmt.Printf("%.3f 0.000\n", x)
		} else {
			fmt.Printf("%.3f %.3f\n", x, y)
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;

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

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

const double EPS=1e-8;
typedef vector<double>vec;
typedef vector<vec>mat;

/// Ax=b
vec gauss_jordan(const mat& A,const vec& b){
    int n=A.size();
    mat B(n,vec(n+1));

    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)B[i][j]=A[i][j];

    for(int i=0;i<n;i++)B[i][n]=b[i];

    for(int i=0;i<n;i++){
        int pivot=i;
        for(int j=i+1;j<n;j++){
            if(abs(B[j][i])<abs(B[pivot][i]))pivot=j;
        }
        swap(B[i],B[pivot]);
        if(abs(B[i][i])<EPS)return vec();

        for(int j=i+1;j<=n;j++)B[i][j]/=B[i][i];
        for(int j=0;j<n;j++){
            if(i==j)continue;
            for(int k=i+1;k<=n;k++)B[j][k]-=B[j][i]*B[i][k];
        }
    }

    vec x(n);
    for(int i=0;i<n;i++)x[i]=B[i][n];
    return x;
}

int main(){
    mat A(2,vec(2));
    vec b(2);

    for(int i=0;i<2;i++){
        scanf("%lf%lf%lf",&A[i][0],&A[i][1],&b[i]);
    }

    vec x=gauss_jordan(A,b);
    printf("%lf %lf\n",x[0],x[1]);
    return 0;
}

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

int main(){
  while(1){
    double A[2][3];
    for(int i=0;i<2;i++){
      for(int j=0;j<3;j++){
	cin>>A[i][j];
	if(cin.eof()) return 0;
      }
    }
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++){
	A[i][j] /= A[i][i];
      }
      for(int k=0;k<2;k++){
	if(k!=i){	  
	  for(int j=i+1;j<3;j++) A[k][j] -= A[k][i]*A[i][j];
	}
      }
    }
    cout<<fixed<<setprecision(3)<<A[0][2]<<" "<<A[1][2]<<endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	int i, n;
	int a[4] = {0}, b[4] = {0};		//ツ係ツ青板行ツ療ア+ツ逆ツ行ツ療ア
	int ans1, ans2;		//ツ督堋つヲ
	
	cin >> n;
	for(i = 0; i < n; i++){
		a[3] = b[2] = 0;
		b[3] = a[2] = 1;
		
		cin >> a[0] >> a[1] >> ans1 >> b[0] >> b[1] >> ans2;
		
		double temp = -1*(b[0]/a[0]);
		for(int j = 0; j < 4; j++){
			b[j] = temp*a[j] +b[j];
		}
		temp = -1*(a[1]/b[1]);
		cout << temp << endl;
		for(int j = 0; j < 4; j++){
			a[j] = temp*b[j] + a[j];
		}
		if(a[0] != 1){
			if(a[0] < 0){
				temp = -1/a[0];
			}
			else{
				temp = 1/a[0];
			}
			for(int j = 0; j < 4; j++){
				a[j] = temp*a[j];
			}
		}
		if(b[1] != 1){
			if(b[1] < 0){
				temp = 1/b[1];
			}
			else{
				temp = 1/b[1];
			}
			for(int j = 0; j < 4; j++){
				b[j] = temp*b[j];
			}
		}
		/*
		for(int j = 0; j < 4; j++){
			cout << a[j] << " " ;
		}
		cout << endl;
		for(int j = 0; j < 4; j++){
			cout << b[j] << " " ;
		}
		*/
		cout << a[2]*ans1 + a[3]*ans2 << endl;
		cout << b[2]*ans1 + b[3]*ans2 << endl;
	}
}

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

int main() {
    string line;
    while (getline(cin, line)) {
        double a, b, c, d, e, f;
        stringstream ss(line);
        ss >> a >> b >> c >> d >> e >> f;


        double x = 0.0;
        if (c*e - b*f != 0)
            x = static_cast<double>(c*e - b*f) / (a*e - b*d);
        double y = 0.0;
        if (a*f - c*d != 0)
            y = static_cast<double>(a*f - c*d) / (a*e - b*d);
        //cout.setf(ios_base::fixed, ios_base::floatfield);
        cout << fixed << setprecision(3);
        cout << x << " " << y << endl;
    }
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	int a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


		cout << fixed << setprecision(3);
		if ((a*e - d*b) == 0)
		{
			cout << 0 << space << 0 << endl;
		}
		else
		{
			x = (e*c - b*f) / (a*e - d*b);
			y = (-d*c + a*f) / (a*e - d*b);

			
			cout << x << space << y << endl;
			
		}
		cout << dec;
	}
}

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

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

}

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

using namespace std;

typedef struct Shiki{
  double a,b,c;//ax+by=c
  double x,y;
};

Shiki Equation (Shiki, Shiki);

Shiki clean={clean.a=0,clean.b=0,clean.c=0,clean.x=0,clean.y=0};

main(){
  Shiki shiki1,shiki2;
  vector<Shiki> ans;
  int i=0;
  
  while(cin){

    cin>>shiki1.a>>shiki1.b>>shiki1.c>>shiki2.a>>shiki2.b>>shiki2.c;
    ans.push_back(Equation(shiki1,shiki2));
    i++;
    shiki1 = clean;
    shiki2 = clean;
  }
 
  for(int j = 0; j < i-1 ;j++){
    cout<< fixed << setprecision(4) << ans[j].x << " " << ans[j].y << endl; 
  }
}

Shiki Equation (Shiki A, Shiki B){
  Shiki ans,preA;
  int x,y,aa,ba;
  
  preA = A;

  aa = A.a;
  ba = B.a;
  
  A.a *= ba;
  A.b *= ba;
  A.c *= ba;
  
  B.a *= aa;
  B.b *= aa;
  B.c *= aa;
  
  ans.a = 0;
  ans.b = A.b - B.b;
  ans.c = A.c - B.c;
  ans.y = ans.c / ans.b;
  ans.x = (preA.c - preA.b*ans.y)/preA.a;
  
  if((int)(ans.y*1000)%10 >= 5)ans.y += 0.0001;
  if((int)(ans.y*1000)%10 >= 5)ans.x += 0.0001;
  
  return ans;
}

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

int main(){
  int i = 0;
  while(1){
  i++;
  int a, b, c, d, e, f;
  scanf("%d ",&a);
  scanf("%d ",&b);
  scanf("%d ",&c);
  scanf("%d ",&d);
  scanf("%d ",&e);
  scanf("%d ",&f);
  
  double x, y;
  x = (double)(c*e-b*f) / (double)(a*e-b*d);
  y = (double)(a*f-c*d) / (double)(a*e-b*d);
  x = (double)round(x*10000.0) / 10000.0;
  y = (double)round(y*10000.0) / 10000.0;
  printf("%.3f %.3f\n", x, y);
  
  if(scanf("%d", &a)==EOF) break;
  else{
    int line = ftell(stdin);
    fseek(stdin, line, SEEK_SET);
  }
  }
  
  return 0;
}

C++: #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) != -1) {
        double x = (c*e - b*f) / (a*e - b*d);
        double y = (c*d - a*f) / (b*d - a*e);
        if (x == -0) x = 0;
        if (y == -0) y = 0;
        printf("%.3f %.3f\n", x, y);
    }

    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<iomanip>
using namespace std;
int main()
{
    double a,b,c,d,e,f,x,y;
    while(cin>>a>>b>>c>>d>>e>>f)
    {

    cout<<setprecision(3)<<fixed;
    x=((-b*f)+(c*e))/(a*e-b*d);
    y=(-c*d+a*f)/(a*e-b*d);
    cout<<x<<" "<<y<<endl;
    }



    return 0;
}