Go: package main

import (
        "fmt"
        "bufio"
        "os"
        "math"
)

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                if x == 0.0 {
                        x = math.Abs(x)
                }
                if y == 0.0 {
                        y = math.Abs(y)
                }
                fmt.Printf("%.3f %.3f\n", x, y)
        }
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	double a,b,c,d,e,f;
	while(cin>>a){
		cin>>b>>c>>d>>e>>f;
		double coeff = a*e-b*d;
		double x = (e*c-b*f)/coeff, y = (-c*d+a*f)/coeff;
		if(abs(x)<=1e-7) x=0;
		if(abs(y)<=1e-7) y=0;
		printf("%.3lf %.3lf\n",round(x*1000.0)/1000.0,round(y*1000.0)/1000.0);
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	cout<<setprecision(4);
	while(cin>>a>>b>>c>>d>>e>>f){
		y=(d*c-f*a)/(b*d-e*a);
		x=(c-b*y)/a;
		printf("%.3f %.2f%d",x,y);
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

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

C++: #include <stdio.h>

float round3(float a){
	a=a*1000;
	a=double (int (a));
	a=a/1000;

}



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=(c*e-b*f)/(a*e-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		x=round3(x);
		y=round3(y);
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include <stdio.h>

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

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

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

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

using namespace std;

string float_to_string(float f, int digits)
{
  if (f == 0) {
    f = 0;
  }
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

void calc_and_output(int *c)
{
  float x = (float)(c[1]*c[5]-c[2]*c[4])/(c[1]*c[3]-c[0]*c[4]);
  float y = (float)(c[0]*c[5]-c[2]*c[3])/(c[0]*c[4]-c[1]*c[3]);

  cout << float_to_string(x, 3) << " " << float_to_string(y, 3) << endl;
}

int main(int argc, char const* argv[])
{
  int c[6];

  string line;
  while (getline(cin, line)) {
    istringstream iss(line);
    int val;
    int c[6];
    for (int i = 0; i < 6; i++) {
      iss >> val;
      c[i] = val;
    };

    calc_and_output(c);
  }

  return 0;
}

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

int main() {
  double a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f) {
    double y = (d*c-a*f)/(d*b-a*e);
    double x = (c-b*y)/a;
    char buff[100];
    sprintf(buff, "%.3f", x);
    if(!strcmp(buff, "-0.000")) x = 0;
    sprintf(buff, "%.3f", y);
    if(!strcmp(buff, "-0.000")) y = 0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <limits>
#define eps 1e-10
using namespace std;

int main(void) {
    double a, b, c, d, e, f;
    double inf = numeric_limits<double>::infinity();
    while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
        double ya = d * c - a * f;
        double yb = b * d - a * e;
        //if(yb == 0) yb += eps;
        double y = ((ya) / (yb));
        if(yb == 0) y = inf;
        //if(a == 0) a += eps;
        double x = ((c - b * y) / a);
        if(a == 0) x = inf;
        printf("%.3f %.3f",x, y);
    }
    
    return(0);
}

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()){


		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 << fixed << setprecision(3);
			cout << x << space << y << endl;
			cout << dec;
		}
	}
}

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

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