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

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

int main()
{
	int a, b, c, d, e, f;
	double 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);
		cout << fixed
			<< setprecision(3)
			<< x<<y<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
    double a,b,c,d,e,f;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> f;
    double det = a*e-b*d;
    double ans1 = (c*e-b*f)/det;
    if(ans1<0.0)ans1 = -ans1;
    double ans2 = (-c*d+a*f)/det;
    if(ans2<0.0)ans2 = -ans2;
    printf("%1.3f %1.3f\n",ans1,ans2);
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double a[2][3];
  bool f=0;
  while(cin>>a[0][0]>>a[0][1]>>a[0][2]>>a[1][0]>>a[1][1]>>a[1][2]){
    if(a[0][0]==0)
      for(int i=0;i<3;i++)swap(a[0][i],a[1][i]),f=1;
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++)
	a[i][j]/=a[i][i];
      a[i][i]=1;
      for(int j=0;j<2;j++){
	if(j==i)continue;
	double t=a[j][i];
	for(int k=i;k<3;k++)
	  a[j][k]-=t*a[i][k];
      }
    }
    if(f)printf("%f %f\n",a[1][2],a[0][2]);
    else printf("%f %f\n",a[0][2],a[1][2]);
  }
  return 0;
}

C++: #include<cstdio>

int a,b,c,d,e,f;
double x,y;

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

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

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

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

int main(int argc, char const *argv[]) {
  double x, y;
  double a, b, c, d, e, f;
  while (!(cin >> a >> b >> c >> d >> e >> f).eof()) {
    x = (f * c - b * d) / (a * f - b * e);
    y = (a * d - c * e) / (a * f - b * e);
    std::cout << fixed << setprecision(3) << x << " " << y << '\n';
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

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

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

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

C++: 5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
#include <iostream>
 
using namespace std;
 
int main(int argc, char **argv)
{
    double a, b, c, d, e, f, tmp, s, t;
     
    while((cin >> a >> b >> c >> d >> e >> f)){
        tmp = (a*e-b*d);
        s = ((e*c-b*f)/tmp);
        t = ((a*f-d*c)/tmp);
         
        if(s == -0.0){
            s = 0.0;
        }
        if(t == -0.0){
            t = 0.0;
        }
        printf("%.3f %.3f\n", s, t);
    }
     
    return 0;
}

C++: using namespace std;
int main(){
    int a,b,c,d,e,f;
    double x,y;
    while(cin>>a>>b>>c>>d>>e>>f){
        if(x != 0) x=(b*f-c*e)/(b*d-a*e);
        else x=0;
        
        if(y != 0)y = (a*f-c*d)/(a*e-b*d);
        else y = 0;
        
        cout<<fixed<<setprecision(3)<<x<<' '<<y<<endl;
    }
    return 0;
}