Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		circleTriangle()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func circleTriangle() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;

struct P{
    double x, y;
    double size(){
        return std::sqrt(x*x + y*y);
    }
    double sizeS(){
        return x*x + y*y;
    }
    P toUnit(){
        return {x / size(), y / size()};
    }
    P rotate(int angle){
        if(angle == 0){ // 反時計
            return {-y, x};
        }
        return {y, -x};
    }
};

P operator+(const P& lp, const P& rp){
    return {lp.x+rp.x, lp.y+rp.y};
}

P operator-(const P& lp, const P& rp){
    return {lp.x-rp.x, lp.y-rp.y};
}

P operator*(const P& p, const double& k){
    return {k*p.x, k*p.y};
}

double cross(const P& lp, const P& rp){
    return lp.x * rp.y - lp.y * rp.x;
}

double roundOff(double v, int k){
    int i = std::abs(v * pow(10, k)) + 0.5;
    if(v >= 0){
        return 1.0 * i / pow(10, k);
    }
    return -1.0 * i / pow(10, k);
}

int main(){
    int N;
    std::cin >> N;

    REP(i, N){
        P A, B, C, v1, v2, v3;
        std::cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
        v1 = B - A; v2 = C - A, v3 = B - C;

        double sinA = std::abs(cross(v1, v2)) / (v1.size() * v2.size()),
            r = v3.size() / 2.0 / sinA, k = std::sqrt(r*r-v1.sizeS()/4);

        P m = v1*0.5, p = A + m + m.rotate(cross(A, C) < 0).toUnit() * k;
    
        printf("%.6f\n", p.x * 1000 + 0.5);

        double x = roundOff(p.x, 3), y = roundOff(p.y, 3), R = roundOff(r, 3);
        printf("%.3f %.3f %.3f\n", x, y, R);
    }
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>

int main() {
	int n;
	std::cin >> n;
	double rax, ray, rbx, rby, rcx, rcy;
	for (int i = 0; i < n; i++) {
		double ax, ay, bx, by, cx, cy, aa, bb, cc, a, b, c, d, e, f, rx, ry, rr;
		std::cin >> rax >> ray >> rbx >> rby >> rcx >> rcy;
		ax = rbx - rax; ay = rby - ray;
		bx = rcx - rbx; by = rcy - rby;
		cx = rax - rcx; cy = ray - rcy;
		std::cerr << ax << " " << bx << " " << cx << std::endl;
		aa = ax * ax + ay * ay;
		bb = bx * bx + by * by;
		cc = cx * cx + cy * cy;
		std::cerr << aa << " " << bb << " " << cc << std::endl;
		a = std::sqrt(aa);
		b = std::sqrt(bb);
		c = std::sqrt(cc);
		std::cerr << a << " " << b << " " << c << std::endl;
		d = aa * (bb + cc - aa);
		e = bb * (cc + aa - bb);
		f = cc * (aa + bb - cc);
		std::cerr << d << " " << e << " " << f << std::endl;
		rx = ((d * rcx) + (e * rax) + (f * rbx)) / (d + e + f);
		ry = ((d * rcy) + (e * ray) + (f * rby)) / (d + e + f);
		rr = (a * b * c) / std::sqrt((a + b + c)*(-a + b + c)*(a - b + c)*(a + b - c));
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << rx << " " << ry << " " << rr << std::endl;
	}

	return 0;
}

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

float round(float val, int d) {
	return (int)(val * pow(10, d) + 0.5) / pow(10,d);
}

int main () {
	int n;
	float x1, x2, x3, y1, y2, y3;
	float m1, m2, b1, b2;
	float x, y, r, hx, hy;
	scanf("%d", &n);
	while (n--) {
		scanf("%f %f %f %f %f %f" , &x1, &y1, &x2, &y2, &x3, &y3);
		if (y1 == y2) {
			x = (x1 + x2) / 2.0;
			m2 = (y3 == y1) ? 0 : (y3 - y1) / (x3 - x1);
			hx = (x1 + x3) / 2.0;
			hy = (y1 + y3) / 2.0;
			b2 = m2 * hx + hy;
			y = -m2 * x + b2;
		} else if (y1 == y3) {
			x = (x1 + x3) / 2.0;
			m1 = (y2 == y1) ? 0 : (y2 - y1) / (x2 - x1);
			hx = (x1 + x2) / 2.0;
			hy = (y1 + y2) / 2.0;
			b1 = m1 * hx + hy;
			y = -m1 * x + b1;
		} else {
			m1 = (x2 == x1) ? 0 : (y2 - y1) / (x2 - x1);
			m2 = (x3 == x1) ? 0 : (y3 - y1) / (x3 - x1);
			hx = (x1 + x2) / 2.0;
			hy = (y1 + y2) / 2.0;
			b1 = m1 * hx + hy;
			hx = (x1 + x3) / 2.0;
			hy = (y1 + y3) / 2.0;
			b2 = m2 * hx + hy;
			x = (b1 - b2) / (m1 - m2);
			y = -m1 * x + b1;
		}
		x = round(x, 3);
		y = round(y, 3);
		r = round(sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)), 3);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

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

int main(){
    int n;
    double x1, x2, x3, y1, y2, y3, x, y;
    cin >> n;
    for(int i = 0;i < n;i++){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	if(y1 == y2)swap(x1, x3), swap(y1, y3);
	else if(y1 == y3)swap(x1, x2), swap(y1, y2);
	double x = (x3-x1)/(y1-y3)*(x1+x3)/2-(x2-x1)/(y1-y2)*(x1+x2)/2+(y1+y2)/2-(y1+y3)/2;
	x /= ((x3-x1)/(y1-y3) - (x2-x1)/(y1-y2));
	double y = (x2-x1)/(y1-y2)*(x - (x1+x2)/2) + (y1+y2)/2;
	cout << x << " " << y << " " << hypot(x1-x,y1-y) << endl;   
    }
    return 0;
}
/*
x1y1 x2y2
y = (x2-x1)/(y1-y2)*(x - x1+x2/2) + y1+y2/2
y = (x3-x1)/(y1-y3)*(x - x1+x3/2) + y1+y3/2


(x3-x1)/(y1-y3)*(x - x1+x3/2) + y1+y3/2
 = (x2-x1)/(y1-y2)*(x - x1+x2/2) + y1+y2/2
((x3-x1)/(y1-y3) - (x2-x1)/(y1-y2))*x
=
(x3-x1)/(y1-y3)*(x1+x3)/2-(x2-x1)/(y1-y2)*(x1+x2)/2+(y1+y2)/2-(y1+y3)/2

*/

C++: #include <iostream>
#include <cmath>


using namespace std;
typedef struct { double x; double y;} point;
 
point getCircumcenter(point a, point b, point c)
{
    double A1 = 2.0f * ( b.x - a.x );
    double B1 = 2.0f * ( b.y - a.y );
    double C1 = pow(a.x,2)-pow(b.x,2) + pow(a.y,2)-pow(b.y,2);
    double A2 = 2.0f * ( c.x - a.x );
    double B2 = 2.0f * ( c.y - a.y );
    double C2 = pow(a.x,2)-pow(c.x,2) + pow(a.y,2)-pow(c.y,2);
    double X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
    double Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
	point P;
	P.x=X;
	P.y=Y;
    return P;
}

double getTwoPointDictance(point a, point b)
{
	return fabs(sqrt(pow((a.x-b.x),2)+pow((a.y-b.y),2)));
}
double AntiMinusZero(double n)
{
	if(n=0)
	{
		return 0.0f;
	}
	return n;
}

int main()
{
    int n;
    cin>>n;
    point a,b,c;
    while(n--)
	{
        cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;
        point ans = getCircumcenter(a,b,c);
        printf("%.3lf %.3lf %.3lf\n", AntiMinusZero(ans.x), AntiMinusZero(ans.y), getTwoPointDictance( a, ans));
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long n,i;
double x1,y1,x2,y2,x3,y3,x,y,r,a1,b1,c1,a2,b2,c2;
cin>>n;
for(i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
a1=(x2-x1)*2;
b1=(y2-y1)*2;
c1=x1*x1-x2*x2+y1*y1-y2*y2;
a2=(x3-x1)*2;
b2=(y3-y1)*2;
c2=x1*x1-x3*x3+y1*y1-y3*y3;
x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
r=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
printf("%.3f %.3f %.3f\n",x,y,r);
}
return 0;
}