Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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

const double EPS = 1e-8;

vector<double> gauss_jordan(const vector< vector<double> >& A, const vector<double>& b){
    int n = A.size();
    vector< vector<double> > B(n, vector<double>(n + 1));
    for(int i = 0 ; i < n ; ++i){
        for(int j = 0 ; j < n ; ++j){
            B[i][j] = A[i][j];
        }
    }
    for(int i = 0 ; i < n ; ++i){
        B[i][n] = b[i];
    }

    for(int i = 0 ; i < n ; ++i){
        int pivot = i;
        for(int j = i ; j < n ; ++j){
            if(abs(B[j][i]) > abs(B[pivot][i])){
                pivot = j;
            }
        }
        swap(B[i], B[pivot]);

        if(abs(B[i][i]) < EPS){
            return vector<double>();
        }

        for(int j = i + 1 ; j <= n ; ++j){
            B[i][j] /= B[i][i];
        }

        for(int j = 0 ; j < n ; ++j){
            if(i != j){
                for(int k = i + 1 ; k <= n ; ++k){
                    B[j][k] -= B[j][i] * B[i][k];
                }
            }
        }
    }

    vector<double> x(n);
    for(int i = 0 ; i < n ; ++i){
        x[i] = B[i][n];
    }

    return x;
}

int main(){
    int n;
    cin >> n;

    while(n--){
        vector< vector<double> > A(2, vector<double>(2));
        vector<double> b(2);
        vector<double> x(3), y(3);
        for(int i = 0 ; i < 3 ; ++i){
            cin >> x[i] >> y[i];
        }
        A[0][0] = 2.0 * (x[0] - x[1]);
        A[0][1] = 2.0 * (y[0] - y[1]);
        b[0] = x[0] * x[0] + y[0] * y[0] - x[1] * x[1] - y[1] * y[1];
        A[1][0] = 2.0 * (x[1] - x[2]);
        A[1][1] = 2.0 * (y[1] - y[2]);
        b[1] = x[1] * x[1] + y[1] * y[1] - x[2] * x[2] - y[2] * y[2];
        vector<double> p = gauss_jordan(A, b);
        double r = sqrt((x[0] - p[0]) * (x[0] - p[0]) + (y[0] - p[1]) * (y[0] - p[1]));
        cout << fixed << setprecision(3) << p[0] << ' ' << p[1] << ' ' << r << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

#include <complex>

typedef complex<double> Point;

const double EPS = 1e-9;

bool eq( double a, double b )
{
	return abs( a - b ) < EPS;
}

bool eq( Point a, Point b )
{
	return eq( a.real(), b.real() ) && eq( a.imag(), b.imag() );
}

double getRadius( double a, double b, double c )
{
	return ( a * b * c ) / sqrt( ( a + b + c ) * ( -a + b + c ) * ( a - b + c ) * ( a + b - c ) );
}

void solve( Point a, Point b, Point c )
{
	double ab = abs( a - b );

	Point unit_ab = ( b - a ) / ab;
	Point mid_ab = Point( ( b - a ).real() / 2, ( b - a ).imag() / 2 );
	Point norm_ab1 = Point( -( unit_ab.imag() ), unit_ab.real() ), norm_ab2 = Point( unit_ab.imag(), -( unit_ab.real() ) );

	double r = getRadius( abs( a - b ), abs( b - c ), abs( c - a ) );
	double t = sqrt( pow( r, 2 ) - pow( ab / 2, 2 ) );

	Point o1 = mid_ab + norm_ab1 * t, o2 = mid_ab + norm_ab2 * t;

	if ( !eq( abs( o1 - c ), r ) )
	{
		swap( o1, o2 );
	}

	cout << o1.real() << ' ' << o1.imag() << ' ' << r << endl;

	return;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	cout.precision( 3 );
	cout << fixed;

	int n;
	cin >> n;

	REP( i, 0, n )
	{
		double a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;

		solve( Point( a, b ), Point( c, d ), Point( e, f ) );
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
#define sqr(x) (x)*(x)
int main(){
  int n;cin>>n;
  double x[3],y[3];
  double px,py,a,b,c,co,si,r;
  for(int i=0;i<3;i++)
    cin>>x[i]>>y[i];
  a=sqrt((sqr(x[1]-x[0])+sqr(y[1]-y[0])));
  b=sqrt((sqr(x[2]-x[1])+sqr(y[2]-y[1])));
  c=sqrt((sqr(x[0]-x[2])+sqr(y[0]-y[2])));
  //cout<<a<<" "<<b<<" "<<c<<endl;
  co=((a*a)-(b*b)-(c*c))/(2*b*c);
  si=sqrt((1-(sqr(co))));
  //cout<<co<<" "<<si<<endl;
  r=a/(si*2.0);
  px=((y[2]-y[1])*(sqr(x[1])+sqr(y[1])-sqr(x[0])-sqr(y[0]))+(y[0]-y[1])*(sqr(x[2])+sqr(y[2])-sqr(x[1])-sqr(y[1])))/(2*((x[1]-x[0])*(y[2]-y[1])-(y[1]-y[0])*(x[2]-x[1])));
  py=((x[1]-x[2])*(sqr(x[1])+sqr(y[1])-sqr(x[0])-sqr(y[0]))+(x[1]-y[0])*(sqr(x[2])+sqr(y[2])-sqr(x[1])-sqr(y[1])))/(2*((x[1]-x[0])*(y[2]-y[1])-(y[1]-y[0])*(x[2]-x[1])));
  printf("%.3lf %.3lf %.3lf\n",px,py,r);
  return 0;
}

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

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		double x[3], y[3], s[3];
		double l, m, n;
		
		for (int j = 0; j < 3; j++){
			scanf("%lf %lf", &x[j], &y[j]);
			s[j] = x[j] * x[j] + y[j] * y[j];
		}
		
		double __x[2], __y[2], __s[2];
		__x[0] = x[0] - x[1];
		__y[0] = y[0] - y[1];
		__s[0] = s[0] - s[1];
		__x[1] = x[0] - x[2];
		__y[1] = y[0] - y[2];
		__s[1] = s[0] - s[2];
		
		m = - (__s[0] * __x[1] - __s[1] * __x[0]) / 
		    (__y[0] * __x[1] - __y[1] * __x[0]);
		l = - (__s[0] * __y[1] - __s[1] * __y[0]) / 
		    (__x[0] * __y[1] - __x[1] * __y[0]);
		n = - s[0] - x[0] * l - y[0] * m;
		
//		printf("x^2 + y^2 + %lfx + %lfy + %lf = 0\n", l, m, n);
		
		double a, b, r;
		a = l / -2;
		b = m / -2;
		r = sqrt(- n - a * a - b * b - l * a - m * b);
		
//		printf("(x - %lf)^2 * (y - %lf)^2 = %lf^2\n", a, b, r);
		
		printf("%.3lf %.3lf %.3lf\n", a, b, r);
	}
	
	return 0;
}

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

int main(){
  double x1,x2,x3,y1,y2,y3,x,n;

  cin >> n;
  int i=0;
  while(i < n){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double sina,R,BC = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3)),p,q;
    sina = ((x2-x1)*(x3-x1) + (y2-y1)*(y3-y1)) / sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))*((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)));

    p = ((y1-y3)*(y1*y1 - y2*y2 + x1*x1 - x2*x2) - (y1-y2)*(y1*y1-y3*y3+x1*x1 -x3*x3))/(2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
    q = ((x1-x3)*(x1*x1 - x2*x2 + y1*y1 - y2*y2) - (x1-x2)*(x1*x1-x3*x3+y1*y1 -y3*y3))/(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
    R = BC/(2*sina);

    cout << setprecision(4) << p << " " << setprecision(4) << q << " " << setprecision(4) << R << endl;
    i++;
  }
}