Go: package main

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

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
                fmt.Printf("%.3f %.3f\n", x, y)
        }
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    const int TMP = 1000;
    for(;;){
        int a,b,c,d,e,f;
        if(!(cin >> a >> b >> c >> d >> e >> f))
            return 0;
        int x = 10 * TMP * (c*e - b*f) / (a*e - b*d);
        int y = 10 * TMP * (c*d - a*f) / (b*d - a*e);
        int xSign = (x>=0? 1:-1);
        int ySign = (y>=0? 1:-1);
        x = abs(x);
        y = abs(y);

        if(x % 10 >= 5)
            x += 10;
        x /= 10;
        if(xSign == -1 && x > 0)
            cout << '-';
        printf("%d.%03d ", x/TMP, x%TMP);

        if(y % 10 >= 5)
            y += 10;
        y /= 10;
        if(ySign == -1 && y > 0)
            cout << '-';
        printf("%d.%03d\n", y/TMP, y%TMP);
    }
}

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

using namespace std;

int main(){

	//FILE *fp;
	//if((fp=fopen("output.txt","w"))==NULL){
	//	return -1;
	//}

	int a,b,c,d,e,f;
	while(1){
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()){
			break;
		}
		double y = (double)(a*f-c*d)/(a*e-b*d);
		double x = (double)(c-b*y)/a;
		fprintf(stdout,"%.3f %.3f\n",x,y);
	}
//	fclose(fp);

	return 0;
}

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

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

	while(1){
		getline( cin, str );
		if( str.size()==0 ){
			break;
		}
		sscanf( str.c_str(), "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f );

		double D  = a*e-b*d;
		double D1 = c*e-f*b;
		double D2 = a*f-d*c;

		if( D == 0.000 ){
			if( (a==0.0) && (d==0.0) ){
				x = 0.0;
				y = c/b;
			}
			if( (b==0.0) && (e==0.0) ){
				x = c/a;
				y = 0.0;
			}
		}
		else{
			x = D1 / D;
			y = D2 / D;
		}

		bool isX = ( (c-a*x)/b == (f-d*x)/e );
		bool isY = ( (c-b*y)/a == (f-e*y)/d );
		if( !isX && isY ){
			x = 0.0;
			y = c/b;
		}else if( isX && !isY ){
			y = 0.0;
			x = c/a;
		}else if( !isX && !isY ){
			x = y = 0.0;
		}

		if( x == -0.000 )	x = 0.000;
		if( y == -0.000 )	y = 0.000;

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

	return 0;
}

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

int main()
{
	for (double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; cout << fixed << setprecision(4) << ((c*e - b*f) != 0 ? (c*e - b*f) / (a*e - b*d) : 0.0000) << ' ' << ((a*f - c*d) != 0 ? (a*f - c*d) / (a*e - b*d) : 0.0000) << endl);
	return 0;
}

C++: #include <stdio.h>
int main(){
	float a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;
	float x = 0,y = 0;

	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) != EOF){
		b *= d / a;
		c *= d / a;
		a *= d / a;
		if((c - f) == 0 || (b - e) == 0){
			y = 0;
		}
		else{
			y = (c - f) / (b - e);
		}
		
		if((c - b * y) == 0 || a == 0){
			x = 0;
		}
		else{
			x = (c - b * y) / a;
		}

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

	}

	return 0;
}

C++: #include<iostream>
int GCM(int a,int b){
	if(b==0)return a;
	return GCM(b,a%b);
}

int main(){
	int a,b,c,d,e,f;
	std::cout.precision(3);
	std::cout.setf(std::ios::fixed);
	while(std::cin>>a>>b>>c>>d>>e>>f){
		double x=0.0,y=0.0;
		double a_=a,b_=b,c_=c,d_=d,e_=e,f_=f;
		b_*=d,c_*=d;
		e_*=a,f_*=a;
		y=(c_-f_)/(b_-e_);
		x=(c-y*b)/a;
		std::cout<<x<<" "<<y<<std::endl;
	}
	return 0;
}

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;
}