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 <iomanip>
#include <cmath>
#include <vector>
using namespace std;
 
int main()
{
    int n;
    vector<double> x(3), y(3), x2(3), y2(3);
    cin >> n;
 
    for(int p=0; p<n; p++)
    {
        cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
        for(int i=0; i<3; i++) { x2[i] = x[i]*x[i]; y2[i] = y[i]*y[i]; }
 
        double a, b, c, a2, b2, c2;
        a2 = abs((x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1]));
        b2 = abs((x[0]-x[2])*(x[0]-x[2]) + (y[0]-y[2])*(y[0]-y[2]));
        c2 = abs((x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0]));
        a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
        double s, S2;
        s = (a + b + c) / 2;
        S2 = s * (s-a) * (s-b) * (s-c);
 
        double cx, cy;
        cx = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
        cy = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
        cout << setprecision(3) << fixed <<
            cx << " " << cy << " " << sqrt(abs((cx-x[0])*(cx-x[0])+(cy-y[0])*(cy-y[0]))) << endl;
    }
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double x,y,r1,r2,r3;
    double a,b,c,d,e,f;
    a=2*x1-2*x2;
    b=2*y1-2*y2;
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*x2-2*x3;
    e=2*y2-2*y3;
    f=x2*x2-x3*x3+y2*y2-y3*y3;
        x=(b*f-e*c)/(a*e-d*b);
        y=(c*d-f*a)/(a*e-d*b);
        
    r1=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
    r2=sqrt((x2-x)*(x2-x)+(y2-y)*(y2-y));
    r3=sqrt((x3-x)*(x3-x)+(y3-y)*(y3-y));
    
    printf("%.3f %.3f %.3f\n",x,y,r1);
}
}

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

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : VP{
    L(const P& a, const P& b){ resize(2); at(0)=a; at(1)=b; }
    L(){ resize(2); }
};
double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B /A *(m[1]-m[0]);
}

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		VP v(3);
		for(int j=0; j<3; j++){
			double x,y;
			cin >> x >> y;
			v[j]=P(x, y);
		}
		L ort1( (v[0]+v[1])*0.5, (v[0]+v[1])*0.5 +(v[1]-v[0])*P(0,1) );
		L ort2( (v[1]+v[2])*0.5, (v[1]+v[2])*0.5 +(v[2]-v[1])*P(0,1) );
		P cp = crosspointLL(ort1, ort2);
		cout << fixed;
		cout << setprecision(3);
		cout << cp.X << " " << cp.Y << " " << abs(cp-v[0]) << endl;
	}
	return 0;
}

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

void OutputCentralCoodinateAndRadius(double x1, double y1, double x2, double y2, double x3, double y3)
{
	double x, y, r;
	if(y1 == y2){
		double xa = (x2 + x3) / 2;
		double ya = (y2 + y3) / 2;
		double a  = (-x3 + x2) / (y3 - y2);
		x = (x1 + x2) / 2;
		y = a * (x - xa) + ya;
	}else{
		double xa = (x1 + x2) / 2;
		double ya = (y1 + y2) / 2;
		double a  = (-x2 + x1) / (y2 - y1);
		double xb = (x2 + x3) / 2;
		double yb = (y2 + y3) / 2;
		double b  = (-x3 + x2) / (y3 - y2);
		x = (b * xb - a * xa - yb + ya) / (b - a);
		y = a * (x - xa) + ya;
	}
	r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
	cout << fixed << setprecision(3) << x << ' ' << y << ' ' << r << endl;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		OutputCentralCoodinateAndRadius(x1, y1, x2, y2, x3, y3);
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int main(){
	ios::sync_with_stdio(false);

	int n;
	vd x(3), y(3);
	double a1, a2, b1, b2, c1, c2;
	double px, py, r;

	scanf("%d", &n);

	for (; n > 0; n--){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

		a1 = 2 * (x[1] - x[0]);
		b1 = 2 * (y[1] - y[0]);
		c1 = x[0] * x[0] - x[1] * x[1] + y[0] * y[0] - y[1] * y[1];

		a2 = 2 * (x[2] - x[0]);
		b2 = 2 * (y[2] - y[0]);
		c2 = x[0] * x[0] - x[2] * x[2] + y[0] * y[0] - y[2] * y[2];

		px = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		py = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
		r = sqrt((px - x[0])*(px - x[0]) + (py - y[0])*(py - y[0]));

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

}