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 <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 <iomanip>

using namespace std;
float a,b,c,d,e,f;
float findoutx,findouty;
float x,y,yadd;
float Timers1,Timers2;
int main()
{
    cin >> a >> b >> c >> d >> e >> f;
    Timers1 = a;
    Timers2 = d;
    a=a*Timers2;
    b=b*Timers2;
    c=c*Timers2;
    d=d*Timers1;
    e=e*Timers1;
    f=f*Timers1;

    findouty=b-e;
    yadd = c-f;
    findouty = yadd/findouty;
    b = b*findouty;
    findoutx=(c-b)/a;



    cout<<fixed<<setprecision(3)<<findoutx << " "<<findouty<<endl;
    return 0;

}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};

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

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

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

C++: #include<iostream>
#include<cstdio>
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);}
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

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


int main() {
  float a, b, c, d, e, f;
  float x, y;
  cout << setprecision(3) << fixed;
    while(cin >> a >> b >> c >> d >> e >> f) {
    x=(b*f-c*e)/(b*d-a*e);
    x = round(x * 1000) / 1000.0;
    cout<<x;
    cout<<" ";
    
    y=(c*d-a*f)/(b*d-a*e);
    y = round(y * 1000) / 1000.0;
    cout<<y;
    cout<<endl;
  }
  
  return 0;
}

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

int main() {
	// your code goes here

  double a,b,c,d,e,f;

  while(cin >> a >> b >> c >> d >> e >> f ){

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

    double x = (c-b*y)/a;


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

  }
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    double res1,res2;
    while(cin>>a>>b>>c>>d>>e>>f)
    {
        int val1=a*e;
        int val2=d*b;
        int res1=val1-val2;
        int val3=e*c;
        int val4=b*f;
        int res2=val3-val4;
        int val5=d*c;
        int val6=a*f;
        int res3=val5-val6;
        double sum1=(double)res2/(double)res1;
        double sum2=(-1)*((double)res3/(double)res1);
        printf("%.3lf %.3lf\n",sum1,sum2);
    }
    return 0;
}

C++: #include <iomanip>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
bool input(Equation& c)
{
	if (!cin) return false;

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N + 1; ++j)
            cin >> c[i][j];
 
    return true;
}
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    Equation c(N, vector<double>(N + 1));
	while (cin >> c[0][0] >> c[0][1] >> c[0][2] >> c[1][0] >> c[1][1] >> c[1][2])
	{
		// Gaussian elimination
		// 1. Forward elimination
        for (int i = 0; i < N - 1; ++i)
            for (int j = i + 1; j < N; ++j)
            {
                double d = c[j][i] / c[i][i];
                for (int k = i + 1; k <= N; ++k)
                    c[j][k] -= c[i][k] * d;
            }
 
		// 2. Back substitution
        for (int i = N - 1; i >= 0; --i)
        {
            double d = c[i][N];
            for (int j = i + 1; j < N; ++j)
                d -= c[i][j] * c[j][N];
            c[i][N] = d / c[i][i];
        }
 
        cout << setprecision(4) << fixed << c[0][N];
        for (int i = 1; i < N; ++i)
            cout << " " << c[i][N];
        cout << endl;
    }
 
    return 0;
}

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()
{
	double x1, y1, a, x2, y2, b;

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

		
	return 0;
}