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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long int ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

void se(double a, double b, double c, double d, double e, double f,double *x,double *y){
	if (a < 0){
		a = -a;
		b = -b;
		c = -c;
	}
	if (d < 0){
		d = -d;
		e = -e;
		f = -f;
	}
	if (a == -0)a = 0;
	if (b == -0)b = 0;
	if (b == -0)b = 0;
	if (b == -0)b = 0;
	if (b == -0)b = 0;
	if (b == -0)b = 0;
	cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << "\n";
	if (a == 0){
		*y = c / b;
		*x = (f - e*(*y)) / d;
	}
	else if (b == 0){
		*x = c / a;
		*y = (f - e*(*x)) / d;
	}
	if (d == 0){
		*y = f / e;
		*x = (c - b*(*y)) / a;
	}
	else if (e == 0){
		*x = f / d;
		*y = (c - a*(*x)) / b;
	}
	else if (a != 0 && b != 0 && d != 0 && e != 0){
		*x = (b*f - c*e) / (b*d - a*e);
		*y = (c*d - a*f) / (b*d - a*e);
	}
}


int main(){
	double x1, y1, x2, y2, x3, y3, px, py, r;
	ll n;
	cin >> n;
	REP(i,n){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		se(2.0*(x1 - x2), 2.0*(y1 - y2),
			pow(x1, 2.0) + pow(y1, 2.0) - pow(x2, 2.0) - pow(y2, 2.0),
			2.0*(x2 - x3), 2.0*(y2 - y3),
			pow(x2, 2.0) + pow(y2, 2.0) - pow(x3, 2.0) - pow(y3, 2.0), &px, &py);
		r = pow(pow(x1 - px, 2.0) + pow(y1 - py, 2.0), 0.5);

		printf("%.3lf %.3lf %.3lf\n", px, py, r);

	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define double long double
using namespace std;

double marume( double x ){
	long long t = x * 1000 + 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		y1 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - x2 * y1;
		double detX = dist1 * y2 - y1 * dist2;
		double detY = x1 * dist2 - dist1 * x1;
		double x = detX / detA;
		double y = detY / detA;
		double r = hypot(x, y);
		
		x += tx;
		y += ty;
		
		x = marume(x);
		y = marume(y);
		r = marume(r);
		printf("%.3Lf %.3Lf %.3Lf\n", x, y, r);
	}
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    for (int n = 0; n != N; ++n) {
        double a, b, c, x1, y1, x2, y2, x3, y3, xp, yp, d, radius;
        while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
            a = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
            b = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
            c = sqrt((x3 - x2)*(x3 - x2) + (y3 - y2)*(y3 - y2));
            radius = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
            d = 2*(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2));
            xp = ((x1*x1 + y1*y1)*(y2-y3) + (x2*x2 + y2*y2)*(y3-y1) + (x3*x3 + y3*y3)*(y1-y2))/d;
            yp = ((x1*x1 + y1*y1)*(x3-x2) + (x2*x2 + y2*y2)*(x1-x3) + (x3*x3 + y3*y3)*(x2-x1))/d;
            cout << fixed << setprecision(3) << xp << " " << yp << " " << radius << endl;
        }
    }
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

typedef double Real;

Real EPS = 1e-8;

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct circle{
  Point p;
  Real r;
  circle(){}
  circle(Point p, Real r) : p(p) , r(r){}
};

circle circumscribed_circle(Point p, Point q, Point r){
  Point a,b,c;
  circle res;
  a=(q-p)*2;
  b=(r-p)*2;
  //c.x=p.dot(p)-q.dot(q);  
  //c.y=p.dot(p)-r.dot(r);

  c.x=p.x*p.x-q.x*q.x+p.y*p.y-q.y*q.y;
  c.y=p.x*p.x-r.x*r.x+p.y*p.y-r.y*r.y;

  res.p.x=a.y*c.y-b.y*c.x;
  res.p.y=b.x*c.x-a.x*c.y;
  res.p=res.p/a.cross(b);
  return circle(res.p, p.dist(res.p));
}

int main(void){
  int n;
  cin >> n;
  while(n--){
    vector<Point>v(3);
    for(int i=0;i<3;i++)
      cin >> v[i].x >> v[i].y;

    circle res=circumscribed_circle(v[0],v[1],v[2]);
    //cout << res.p.x << " " << res.p.y << " " << res.r << endl;
    printf("%.4f %.4f %.4f",res.p.x,res.p.y,res.r);
    cout << endl;
  }
  
  return 0;
}

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

struct Line {
  double a;
  double b;
  double c;
};

typedef pair<double, double> Pair;

int n;
double xs[3];
double ys[3];

double Dist(Pair p1, Pair p2) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return sqrt(dx*dx+dy*dy);
}

Pair Intersect(Line &l1, Line &l2) {
  double a1 = l1.a;
  double b1 = l1.b;
  double c1 = l1.c;
  double a2 = l2.a;
  double b2 = l2.b;
  double c2 = l2.c;
  double x = (b1*c2 - b2*c1)/(a1*b2-a2*b1);
  double y = (a1*c2 - a2*c1)/(a2*b1-a1*b2);
  return Pair(x, y);
}

int main() {
  scanf("%d", &n);
  while (n--) {
    for (int i=0; i<3; i++) {
      scanf("%lf%lf", &xs[i], &ys[i]);
    }

    Line l1, l2;
    l1.a = xs[1]-xs[0];
    l1.b = ys[1]-ys[0];
    l1.c = -(xs[1]*xs[1]-xs[0]*xs[0] + ys[1]*ys[1]-ys[0]*ys[0])/2;
    l2.a = xs[2]-xs[1];
    l2.b = ys[2]-ys[1];
    l2.c = (xs[1]*xs[1]-xs[2]*xs[2] + ys[1]*ys[1]-ys[2]*ys[2])/2;
    Pair p = Intersect(l1, l2);
    double r = Dist(p, Pair(xs[0], ys[0]));
    p.first = int(p.first*1000+0.5)/1000.0;
    p.second = int(p.second*1000+0.5)/1000.0;
    r = int(r*1000+0.5)/1000.0;
    printf("%.3f %.3f %.3f\n", p.first, p.second, r);
  }
}