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 <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
  
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
  
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
  
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
  
    ret = cross(p1,p2)/2.0;
      
    return abs(ret);
}
  
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
          
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        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 i = 0;i<n;i++){
    double x1,y1,x2,y2,x3,y3,a1,b1,c1,a2,b2,c2,x,y,ab;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = 2*(x2-x1);
    b1 = 2*(y2-y1);
    c1 = (x1 * x1) - (x2 * x2) + (y1 * y1) - (y2 * y2);
    a2 = 2*(x3 - x1);
    b2 = 2*(y3 - y1);
    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));
    ab = sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
    cout << fixed << setprecision(3) << x <<" "<< y <<" "<< ab << endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int n;
    cin >> n;
     
    while(n-- > 0){
     
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
     
    double a = 2 * (x2 - x1);
    double b = 2 * (y2 - y1);
    double c = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
    double d = 2 * (x3 - x2);
    double e = 2 * (y3 - y2);
    double f = x2 * x2 - x3 * x3 + y2 * y2 - y3 * y3;
         
    double cx = (b * f - c * e)/(a * e - d * b);
    double cy = (a * f - c * d)/(b * d - a * e);
         
    double r = sqrt((x1 - cx)*(x1 - cx) + (y1 - cy)*(y1 - cy));
     
    cout << fixed << setprecision(3) << cx << " " << cy << " " << r << endl;
     
    }
     
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	int n;
	cin >> n;
	REP(i, n){
		double x1, x2, x3, y1, y2, y3;
		cin >> x1>> x2 >> x3 >> y1 >> y2 >> y3;

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;
		/*
		double xc = 1.0*((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = 1.0*((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		*/

		double xc = ((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));

		double yc = ((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));

		double d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		d = sqrt(d);

		printf("%.3lf %.3lf %.3lf\n", xc, yc, d);
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
int n;
cin>>n;
rep(i,n){
double a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
double x,y,r;
double p,q,s,t,u,v,w,z;
p=b-f;
q=e-a;
s=(a+c)/2;
t=(b+f)/2;

u=b-d;
w=(a+c)/2;
v=c-a;
z=(b+d)/2;

x=(v*p*w-u*p*z-u*p*s+u*p*t)/(v*p-u*q);
if(u)y=v*(x-w)/u+z;
else y=q*(x-s)/p+t;
r=hypot(x-a,y-b);

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

C++: using System;

class main
{
    static void Main(string[] args)
    {
        string s = string.Empty;
        var n = int.Parse(Console.ReadLine());        
        while (n-- != 0)
        {
            s = Console.ReadLine();
            string[] s1 = s.Split(' ');
            double x1 = double.Parse(s1[0]);
            double x2 = double.Parse(s1[1]);
            double x3 = double.Parse(s1[2]);
            double y1 = double.Parse(s1[3]);
            double y2 = double.Parse(s1[4]);
            double y3 = double.Parse(s1[5]);
            double a = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
            double b = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
            double c = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
            double r = (a * b * c) / Math.Sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
            double x = (((x1 * x1 + y1 * y1) * (y2 - y3)) + ((x2 * x2 + y2 * y2) * (y3 - y1)) + ((x3 * x3 + y3 * y3) * (y1 - y2))) / ((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2))) * 0.5;
            double y = (((x1 * x1 + y1 * y1) * (x2 - x3)) + ((x2 * x2 + y2 * y2) * (x3 - x1)) + ((x3 * x3 + y3 * y3) * (x1 - x2))) / ((y1 * (x2 - x3)) + (y2 * (x3 - x1)) + (y3 * (x1 - x2))) * 0.5;
            Console.WriteLine("{0:F3} {1:F3} {2:F3}", x, y, r);
        }
        Console.ReadKey();
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	double x1,x2,x3,y1,y2,y3,x12,x13,y12,y13,xx12,yy12,xx13,yy13,x,y,r;
	for(int i=0;i<n;i++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		
		x12=x1-x2;
		x13=x1-x3;
		y12=y1-y2;
		y13=y1-y3;
		xx12=x1*x1-x2*x2;
		xx13=x1*x1-x3*x3;
		yy12=y1*y1-y2*y2;
		yy13=y1*y1-y3*y3;
		
		x=-0.5*(y12*(xx13+yy13)-y13*(xx12+yy12))/(x12*y13-x13*y12);
		y=-0.5*(x12*(xx13+yy13)-x13*(xx12+yy12))/(y12*x13-y13*x12);
		r=sqrt(x*x+y*y+x1*x1+y1*y1-2*x*x1-2*y*y1);
		
		printf("%.3lf %.3lf %.3lf\n",x,y,r);
		
	}
	return 0;
}