Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func mathRound(f float64) float64 {
	return math.Floor(f + .5)
}

func round(x float64) float64 {
	if math.Abs(x) < 0.001 {
		return 0
	}
	return mathRound(x*1000) / 1000
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		a, err := nextFloat64()
		if err != nil {
			break
		}
		b, _ := nextFloat64()
		c, _ := nextFloat64()
		d, _ := nextFloat64()
		e, _ := nextFloat64()
		f, _ := nextFloat64()

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

		fmt.Printf("%.3f %.3f\n", round(x), round(y))
	}
}

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

int main(){
	double a11=0,a12=0,c=0,a21=0,a22=0,f=0;
	while(cin>>a11){
		cin>>a12>>c>>a21>>a22>>f;
		double x,y,delta=((double)a11*a22-(double)a12*a21);
		x=((double)a22*c-(double)a12*f)/delta;
		y=((double)a11*f-(double)c*a21)/delta;
		if(x>0){x=(double)(((int)((x*1000)+0.5))/1000);
		}else{x=(double)(((int)((x*1000)-0.5))/1000);}
		if(y>0){y=(double)(((int)((y*1000)+0.5))/1000);
		}else{y=(double)(((int)((y*1000)-0.5))/1000);}
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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

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

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

int main(void){
    int a,b,c,d,e,f;
    double ansX,ansY;
    while(std::cin >> a >> b >> c >> d >> e >> f){
        ansX = (c*e - b*f) / (a*e - b*d);
        ansX *= 1000;
        if(ansX > 0) ansX += 0.5;
        else ansX -= 0.5;
        ansX = int(ansX);
        ansX /= 1000;
        
        ansY = (a*f - c*d) / (a*e - b*d);
        ansY *= 1000;
        if(ansY > 0) ansY += 0.5;
        else ansY -= 0.5;
        ansY = int(ansY);
        ansY /= 1000;
        
        std::cout <<fixed << setprecision(3) << ansX << " " << fixed << setprecision(3)<<ansY << std::endl;
    }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
void calc(double x1, double y1, double a, double x2, double y2, double b)
{
	double d1 = x2;
	double d2 = x1;
	double xx1 = d1 * x1;
	double xy1 = d1 * y1;
	double a1 = d1 * a;
	double xx2 = d2 * x2;
	double xy2 = d2 * y2;
	double b1 = d2 * b;
	double y = xy1 - xy2;
	double c = a1 - b1;
	y = c / y;


	d1 = y2;
	d2 = y1;
	xx1 = d1 * x1;
	xy1 = d1 * y1;
	a1 = d1 * a;
	xx2 = d2 * x2;
	xy2 = d2 * y2;
	b1 = d2 * b;
	double x = xx1 - xx2;
	c = a1 - b1;
	x = c / x;
	if (x == 0)
	{
		x = 0;
	}
	if (y == 0)
	{
		y = 0;
	}
	printf("%.3lf %.3lf\n", x, y);
}
int main(int argc, char const *argv[])
{
	int x1, y1, a, x2, y2, b;

	while(scanf_s("%d %d %d %d %d %d", &x1, &y1, &a, &x2, &y2, &b) != EOF)
	{
		calc(x1, y1, a, x2, y2, b);
	}

		
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main () {
	double m[4], e, f, d, x, y;
	cout.setf (ios::fixed); cout.precision (3);
	while (cin >> m[0] >> m[1] >> e >> m[2] >> m[3] >> f) {
		d = m[0]*m[3] - m[1]*m[2];
		if (0.0 == ((x = (m[3]*e - m[1]*f)/d) + 0.0)) x = 0.0;
		if (0.0 == ((y = (m[0]*f - m[2]*e)/d) + 0.0)) y = 0.0;
		cout << x << " " << y << endl;
	}
}

C++: #include<cstdio>
#include<cmath>
#include<utility>
using namespace std;
pair<double,double> solve(double *a){
    double x,y;
    if(a[0]==0){
        y=a[2]/a[1];
        x=(a[5]-a[4]*y)/a[3];
    }else if(a[1]==0){
        x=a[2]/a[0];
        y=(a[5]-a[3]*x)/a[4];
    }else if(a[3]==0){
        y=a[5]/a[4];
        x=(a[2]-a[1]*y)/a[0];
    }else if(a[4]==0){
        x=a[5]/a[3];
        y=(a[2]-a[0]*x)/a[1];
    }else{
        y=(a[2]-(a[5]*(a[0]/a[3])))/(a[1]-(a[4]*(a[0]/a[3])));
        x=(a[2]-a[1]*y)/a[0];
    }
    return make_pair(x,y);
}
int main(){
    double a[6];
    for(;;){
        for(int i=0;i<6;i++){
            if(scanf("%lf",&a[i])==-1)return 0;
        }
        pair<double,double> ans=solve(a);
        printf("%.3lf %.3lf\n",rint(ans.first*1000)/1000.0,rint(ans.second*1000)/1000.0);
    }
}

C++: #include <iostream> 
using namespace std;
const int n = 1000, m = 1000, j = 1000, h = 1000, k = 1000, l = 1000, q = 1000, w = 1000;
double a[n], b[m], c[j], d[h], e[k], f[l];
double x[q], y[w]; 
int main () {
	for (int i = 1; i<= 2; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i] >> e[i] >> f[i];
	}

	for (int i = 1; i<= 2; i++) {
		x[i] = (c[i] * e[i] - b[i] * f[i]) / (a[i] * e[i] - b[i] * d[i]);
		y[i] = (a[i] * f[i] - c[i] * d[i]) / (a[i] * e[i] - b[i] * d[i]);
		printf ("%.3f %.3f", x[i], y[i]);
		cout << endl;
	}
	
	return 0;
}

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){
				ansx[i] += 0.001;
			}
			if (((int)(ansy[i] * 10000) % 10) > 4){
				ansy[i] += 0.001;
			}
		}
		i++;
	}

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

C++: #include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,x,y;
  while(cin >> a >> b >> c >> d >> e >> f){
    x = (b*f-e*c)/(b*d-e*a) * 1000 ;
    if(x > 0){
      x += 0.5 ;
    }
    else if(x < 0){
      x -= 0.5 ;
    }
    x = (double)((int)(x))/1000.0 ;
    y = (c*d-a*f)/(b*d-e*a) * 1000 ;
    if(y > 0){
      y += 0.5 ;
    }
    else if(y < 0){
      y -= 0.5 ;
    }
    y =(double)((int)(y))/1000 ;
    cout << x << " " << y << endl;
  }
  return 0;
}

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

int main(){
	double a,b,c,d,e,f,det;
	double x,y;
	//cout << "Input the number: ";
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> f;
	det = a*e-b*d;
//	if(det == 0) cout << "No answer" << endl;
	x = (1.0/det)*(e*c-b*f);
	y = (1.0/det)*(a*f-d*c);
//	cout << "x:" << x << " y:" << y << endl;
	cout << x << " " << y << endl;
	return 0;
}

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

int main(){
	float a,b,c,d,e,f,x,y;
	while(scanf("%f",&a)){
	scanf("%f%f%f%f%f",&b,&c,&d,&e,&f);
	x=(c*e-b*f)/(a*e-b*d);
	y=(c*d-a*f)/(b*d-a*e);
	if(x>-0.0005&&x<=0.0005){
		x=0;
	}
	if(y>-0.0005&&y<=0.0005){
		y=0;
	}
	printf("%.3f %.3f",x,y);
	std::cout<<std::endl;
	}
	return 0;
	}