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<cstdio>
#include<cmath>
#include<utility>
using namespace std;
pair<double,double> solve(double a[6]){
    double x,y;
    if(a[0]==0){
        y=a[2]/a[1];
        x=(a[5]-a[4]*y)/a[3];
    }else if(a[1]==0){
        x=a[2]/a[0];
        y=(a[5]-a[3]*x)/a[4];
    }else if(a[3]==0){
        y=a[5]/a[4];
        x=(a[2]-a[1]*y)/a[0];
    }else if(a[4]==0){
        x=a[5]/a[3];
        y=(a[2]-a[0]*x)/a[1];
    }else{
        y=(a[2]-(a[5]*(a[0]/a[3])))/(a[1]-(a[4]*(a[0]/a[3])));
        x=(a[2]-a[1]*y)/a[0];
    }
    return make_pair(x,y);
}

typedef pair<double,double> V;
int main(){
    int n;
    scanf("%d",&n);
    double x[3],y[3];
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            scanf("%lf%lf",&x[j],&y[j]);
        }
        V va=V(x[1]-x[0],y[1]-y[0]),vb(x[2]-x[0],y[2]-y[0]);
        V vlia=V(-va.second,va.first),vlib=V(-vb.second,vb.first),vhalfa=V(va.first/2,va.second/2),vhalfb=V(vb.first/2,vb.second/2);
        double a[6];
        a[0]=vlia.first,a[1]=-vlib.first,a[2]=-(vhalfa.first)+vhalfb.first,a[3]=vlia.second,a[4]=-vlib.second,a[5]=-(vhalfa.second)+vhalfb.second;
        double t=solve(a).first;
        V ans=V(vhalfa.first+t*vlia.first+x[0],vhalfa.second+t*vlia.second+y[0]);
        double r=sqrt((x[0]-ans.first)*(x[0]-ans.first)+(y[0]-ans.second)*(y[0]-ans.second));
        printf("%.3lf %.3lf %.3lf\n",rint(ans.first*1000)/1000.0,rint(ans.second*1000)/1000.0,rint(r*1000)/1000.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);
	printf("%.3f\n", round(1.2343, 3));
	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<cstdio>
#include<cmath>
using namespace std;
int main(){
    int a;
    scanf("%d",&a);
    for(;a>0;a--){
        double a1,a2,b1,b2,c1,c2,x1,y1,x2,y2,x3,y3;
        double x,y,r;
        scanf("%lf%lf%lf%lf%lf%lf",&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);
        r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
    return 0;
}

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

using namespace std;

int main()
{
    int num;
    cin >> num;
    double x1, x2, x3, y1, y2, y3;
    double px, py, r;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3)
    {
        px = (1 / 2.0) * ((x1 * x1 + y1 * y1) * (y3 - y2) + (x2 * x2 + y2 * y2) * (y1 - y3)
            + (x3 * x3 + y3 * y3) * (y2 - y1)) / (x1 * (y3 - y1) + x2 * (y1 - y3) + x3 * (y2 - y1));
        py = -(x3 - x2) / (y3 - y2) * px + (1 / 2.0) * (x3 * x3 - x2 * x2 + y3 * y3 - y2 * y2) / (y3 - y2);
        r = sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py));

        cout << fixed << setprecision(3) << round(px * 1000) / 1000 << " " << round(py * 1000) / 1000 << " " << round(r * 1000) / 1000 << endl;
    }
}

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

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3, a, b, c, d, e, f, x, y, r;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
		b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
		c = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		d = acos((b * b + c * c - a * a) / (2 * b * c));
		e = acos((a * a + c * c - b * b) / (2 * a * c));
		f = acos((b * b + a * a - c * c) / (2 * b * a));
		x = (x1 * sin(d * 2) + x2 * sin(e * 2) + x3 * sin(f * 2)) / (sin(d * 2) + sin(e * 2) + sin(f * 2));
		y = (y1 * sin(d * 2) + y2 * sin(e * 2) + y3 * sin(f * 2)) / (sin(d * 2) + sin(e * 2) + sin(f * 2));
		r = a / (2 * sin(d));
		printf("%.3f %.3f %.3f\n",x,y,r);
	}
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double x1, y1, x2, y2, x3, y3;
	double a1, b1, c1, a2, b2, c2;
	double ansx, ansy, ansr;
	int n;
	cin >> n;

	while(n--)
	{
		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;
		ansx = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
		ansy = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);
		ansr = sqrt( (x1-ansx)*(x1-ansx) + (y1-ansy)*(y1-ansy) );
		printf("%.3f %.3f %.3f\n", ansx, ansy, ansr);
	}
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

pair<double,double> solve(double a,double b,double c,double d,double e,double f)
{
	return mp((c*e-b*f)/(a*e-b*d),(a*f-c*d)/(a*e-b*d));
}

int main()
{
	int n;
	cin>>n;
	rep(i,n){
		vector<double> x(3),y(3);
		rep(j,3)
			cin>>x[j]>>y[j];
		double x0=x[0],y0=y[0];
		rep(j,3){
			x[j]-=x0;
			y[j]-=y0;
		}
		pair<double,double> res=solve(
			2*x[1],2*y[1],x[1]*x[1]+y[1]*y[1],
			2*x[2],2*y[2],x[2]*x[2]+y[2]*y[2]);
		printf("%.3f %.3f %.3f\n",res.first+x0,res.second+y0,hypot(res.first,res.second));
	}
	
	return 0;
}