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 <bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(3)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

const double PI = acos(-1.0);
bool eq(double a, double b) { return fabs(a - b) < EPS; }
typedef complex<double> Point;
typedef vector<Point> Polygon;

namespace std
{
	bool operator < (const Point& a, const Point& b)
	{
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

struct Line
{
	Point a, b;
	Line(Point p, Point q) :a(p), b(q) {};
};

struct Circle
{
	Point p; double r;
	Circle(Point a, double b) :p(a), r(b) {};
};

double dot(Point a, Point b)
{
	return real(conj(a)*b);
}

double cross(Point a, Point b)
{
	return imag(conj(a)*b);
}

int ccw(Point a, Point b, Point c)
{
	b -= a; c -= a;
	if (cross(b, c) > EPS) return 1;	//counter cloclwise
	if (cross(b, c) < -EPS) return -1;  //cloclwise
	if (dot(b, c) < 0) return 2;		//c--a--b on line 
	if (norm(b) < norm(c)) return -2;   //a--b--c on line
	return 0;							//a--c--b on line
}

bool isis_ll(Line l, Line m)
{
	return abs(cross(l.b - l.a, m.b - m.a)) > EPS;
}

bool isis_ls(Line l, Line s)
{
	return cross(l.b - l.a, s.a - l.a)*cross(l.b - l.a, s.b - s.a) < EPS;
}

bool isis_ss(Line s, Line t)
{
	return (ccw(s.a, s.b, t.a)*ccw(s.a, s.b, t.b) <= 0 &&
		ccw(t.a, t.b, s.a)*ccw(t.a, t.b, s.b) <= 0);
}

bool isis_lp(Line l, Point p)
{
	return (abs(cross(l.b - p, l.a - p)) < EPS);
}

bool isis_sp(Line s, Point p)
{
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a)) < EPS;
}

Point projection(Line l, Point p)
{
	Point base = l.b - l.a;
	double r = dot(p - l.a, base) / norm(base);
	return l.a + base*r;
}

Point mirror(Line l, Point p)
{
	return 2.0*projection(l, p) - p;
}

double dist_lp(Line l, Point p)
{
	return abs(p - projection(l, p));
}

double dist_ll(Line l, Line m)
{
	return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

double dist_ls(Line l, Line s)
{
	if (isis_ls(l, s)) return 0;
	return min(dist_lp(l, s.a), dist_lp(l, s.b));
}

double dist_sp(Line s, Point p)
{
	Point r = projection(s, p);
	if (isis_sp(s, r)) return abs(r - p);
	return min(abs(s.a - p), abs(s.b - p));
}

double dist_ss(Line s, Line t)
{
	if (isis_ss(s, t)) return 0;
	return min(min(dist_sp(s, t.a), dist_sp(s, t.b)), min(dist_sp(t, s.a), dist_sp(t, s.b)));
}

Point is_ll(Line s, Line t)
{
	double a = cross(s.b - s.a, t.b - t.a);
	double b = cross(s.b - s.a, s.b - t.a);
	return t.a + b / a*(t.b - t.a);
}

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		double x[3], y[3];
		REP(i, 3) cin >> x[i] >> y[i];
		Point p(x[0], y[0]), q(x[1], y[1]), r(x[2], y[2]);
		Point s = q - p, t = r - p;

		Line a((p + q)*0.5, (p + q)*0.5 + s*Point(0,1));
		Line b((p + r)*0.5, (p + r)*0.5 + t*Point(0,1));
		Point ans = is_ll(a, b);
		printf("%.3lf %.3lf %.3lf\n", ans.real(), ans.imag(), abs(ans - p));
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double xy[6],a,b,c,d,e,f,x,y,r;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
			cin>>xy[j];

		a=2.0*(xy[x2]-xy[x1]);
		b=2.0*(xy[y2]-xy[y1]);
		c=2.0*(xy[x3]-xy[x2]);
		d=2.0*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt((xy[x1]-x)*(xy[x1]-x)+(xy[y1]-y)*(xy[y1]-y));

		if(x<0)
			x-=0.0005;
		else
			x+=0.0005;
		if(y>0)
			y-=0.0005;
		else
			y+=0.0005;
		r+=0.0005;

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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;


double heron(double a,double b, double c){
	double s = (a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}


int n;
double x[3],y[3];

int main(){
	cin>>n;
	rep(i,n){
		rep(j,3) cin>>x[j]>>y[j];
		P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
		double al = abs(b-c),bl=abs(c-a),cl=abs(a-b);
		double s = heron(al,bl,cl);
		double al2=al*al,bl2=bl*bl,cl2=cl*cl;
		P I = ((16*s*s-bl2*(cl2+al2-bl2)-cl2*(al2+bl2-cl2))*a + bl2*(cl2+al2-bl2)*b + cl2*(al2+bl2-cl2)*c)/(16*s*s);
		printf("%0.3f %0.3f %0.3f\n",I.real(),imag(I),abs(I-a));
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double xy[6],a,b,c,d,e,f,x,y,r;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
			cin>>xy[j];

		a=2.0*(xy[x2]-xy[x1]);
		b=2.0*(xy[y2]-xy[y1]);
		c=2.0*(xy[x3]-xy[x2]);
		d=2.0*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt((xy[x1]-x)*(xy[x1]-x)+(xy[y1]-y)*(xy[y1]-y));

		

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

C++: #include <iostream>
#include <math.h>

using namespace std;

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

	for(int i=0; i<n; i++){
		double x1, y1, x2, y2, x3, y3;
		double px, py, r;

		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		px = (x1 + x2 + x3) / 3;
		py = (y1 + y2 + y3) / 3;
		r = sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py));

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

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

double length(double x1, double y1, double x2, double y2){
	double x = x1 - x2;
	double y = y1 - y2;
	return sqrt(x*x + y*y);
}

int main(){
	int n, i;
	double x1, x2, x3, y1, y2, y3;
	double r, xp, yp, a, b, c, S;
	cin >> n;
	for(i=0; i<n; i++){
		cin >> x1 >> y1 >> x2 >>  y2 >> x3 >> y3;

		a = length(x1, y1, x2, y2);
		b = length(x2, y2, x3, y3);
		c = length(x3, y3, x1, y1);

		r = a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
		S = a*b*c/(4*r);
		xp = ((a*a)*(b*b + c*c - a*a)*x3+(b*b)*(c*c + a*a - b*b)*x1+(c*c)*(a*a + b*b - c*c)*x2)/(16*S*S); 
		yp = ((a*a)*(b*b + c*c - a*a)*y3+(b*b)*(c*c + a*a - b*b)*y1+(c*c)*(a*a + b*b - c*c)*y2)/(16*S*S); 

		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}

	return 0;
}