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<cmath>
#include<iomanip>
#include<array>

//#define P(p) pow 

using namespace std;

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		array<pair<double,double>,3>p;
		cin>>p[0].first>>p[0].second>>p[1].first>>p[1].second>>p[2].first>>p[2].second;

		pair<long double, long double >o(
			 ((p[2].second - p[1].second) * (pow(p[1].first, 2.0) - pow(p[0].first, 2.0) + pow(p[1].second, 2.0) - pow(p[0].second, 2.0)) - (p[1].second - p[0].second) * (pow(p[2].first, 2.0) - pow(p[1].first, 2.0) + pow(p[2].second, 2.0) - pow(p[1].second, 2.0))) / (2.0 * ((p[1].first - p[0].first) * (p[2].second - p[1].second) - (p[1].second - p[0].second) * (p[2].first - p[1].first))),
                (- (p[2].first - p[1].first) * (pow(p[1].first, 2.0) - pow(p[0].first, 2.0) + pow(p[1].second, 2.0) - pow(p[0].second, 2.0)) + (p[1].first - p[0].first) * (pow(p[2].first, 2.0) - pow(p[1].first, 2.0) + pow(p[2].second, 2.0) - pow(p[1].second, 2.0))) / (2.0 * ((p[1].first - p[0].first) * (p[2].second - p[1].second) - (p[1].second - p[0].second) * (p[2].first - p[1].first)))
				);

		long double r=sqrt(pow(p[0].first - o.first, 2) + pow(p[0].second - o.second, 2));

		cout<<fixed<<setprecision(3)<<o.first<<" "<<o.second<<" "<<r<<endl;
	}
	return 0;
	
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{
    int nb_cas;
    cin>>nb_cas;
    while(nb_cas--)
    {
        double x1,y1,x2,y2,x3,y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double a1=(x2-x1)*2;
        double b1=(y2-y1)*2;
        double c1=x1*x1-x2*x2+y1*y1-y2*y2;
        double a2=(x3-x1)*2;
        double b2=(y3-y1)*2;
        double c2=x1*x1-x3*x3+y1*y1-y3*y3;
        double xc=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        double yc=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        double r=sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc));
        cout<<fixed<<setprecision(3)<<xc<<" "<<yc<<" "<<r<<endl;
    }
}

C++: /*
A1＝2(X2?X1)
B1＝2(Y2?Y1)
C1＝X12?X22＋Y12?Y22
A2＝2(X3?X1)
B2＝2(Y3?Y1)
C2＝X12?X32＋Y12?Y32

X＝(B1C2?B2C1)/(A1B2?A2B1)
Y＝(C1A2?C2A1)/(A1B2?A2B1)
*/
#include <fstream>
#include <iostream>
#include <math.h>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  int n;
  cin >> n;
  while (n--) {
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a1 = 2 * (x2 - x1);
    double b1 = 2 * (y2 - y1);
    double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
    double a2 = 2 * (x3 - x1);
    double b2 = 2 * (y3 - y1);
    double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;

    double px = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    double py = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    double r = sqrt((px - x1) * (px - x1) + (py - y1) * (py - y1));

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

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		double x[3], y[3];
		for (int j = 0; j < 3; ++j)
			scanf("%lf %lf", x+j, y+j);
		
		double a[2], b[2];
		for (int j = 0, c = 0; j < 3 && c < 2; ++j)
		{
			for (int k = j+1; k < 3 && c < 2; ++k)
			{
				if (y[j] == y[k])
					continue;

				a[c] = -(x[k]-x[j])/(y[k]-y[j]);
				b[c] = (y[k]+y[j] - (x[k]+x[j])*a[c])/2;
				++c;
			}
		}
		double px = (b[0]-b[1])/(a[1]-a[0]);
		double py = a[0] * px + b[0];
		double r = sqrt((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0]));
		printf("%.3f %.3f %.3f\n", px, py, r);
	}

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define P(x) pow(double(x),2)



int main(){


	int i,j,k;
	int n;
	double x[3],y[3];
	double xp,yp,r;
	double a1,a2,b1,b2,c1,c2;
	
	while((scanf("%d",&n))!=EOF){
		for(i=0;i<3;i++){
			scanf("%lf",&x[i]);
			scanf("%lf",&y[i]);
		}
		a1=2*(x[1]-x[0]);
		a2=2*(x[2]-x[1]);
		b1=2*(y[1]-y[0]);
		b2=2*(y[2]-y[1]);
		c1=(P(x[0])-P(x[1])+P(y[0])-P(y[1]));
		c2=(P(x[1])-P(x[2])+P(y[1])-P(y[2]));
	
		xp=(b1*c2-b2*c1)/(a1*b2-a2*b1);
		yp=(c1*a2-c2*a1)/(a1*b2-a2*b1);
		r=(double)(sqrt((long double)(((xp-x[0])*(xp-x[0]))+((yp-y[0])*(yp-y[0])))));	


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

	}



}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {

	int n;
	double x1, x2, x3, y1, y2, y3;
	double X, Y, R;
	double a, b, c, d, e, f;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		a = -x2 + x3;
		b = -x1*x1 + x2*x2 - y1*y1 + y2*y2;
		c = x1 - x2;
		d = -x2*x2 + x3*x3 - y2*y2 + y3*y3;
		e = -c * 2 * (y2 - y3);
		f = a * 2 * (y1 - y2);

		Y = (a*b + c*d) / (e - f);
		X = (b+2*Y*(y1-y2))/(-2*c);
		R = sqrt((X - x1)*(X - x1) + (Y-y1)*(Y-y1));

		if (X > 0)
			X = (int)(X * 1000 + 0.5) ;
		else X = (int)(X * 1000 - 0.5) ;

		if (Y>0)
			Y = (int)(Y * 1000 + 0.5) ;
		else Y = (int)(Y * 1000 - 0.5) ;

		if (R > 0)
			R = (int)(R * 1000 + 0.5);
		else R = (int)(R * 1000 - 0.5);

		printf("%.3f %.3f %.3f\n", X/1000, Y/1000, R/1000);
	}


	return 0;
}

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

int main() {
	int sampleNum;
	scanf("%d", &sampleNum);
	for (; sampleNum > 0; --sampleNum) {
		double x1, y1, x2, y2, x3, y3;
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		double ax = x2 - x1;
		double ay = y2 - y1;
		double a = sqrt(ax * ax + ay * ay);
		double bx = x3 - x1;
		double by = y3 - y1;
		double b = sqrt(bx * bx + by * by);
		double cx = x3 - x2;
		double cy = y3 - y2;
		double c = sqrt(cx * cx + cy * cy);

		double crossabz = ax * by - ay * bx;
		double crossbcz = bx * cy - by * cx;
		double crosscaz = cx * ay - cy * ax;

		double sinA = crossbcz / (b * c);
		double sinB = crosscaz / (c * a);
		double sinC = crossabz / (a * b);
		double sin2A = sin(2.*asin(sinA));
		double sin2B = sin(2.*asin(sinB));
		double sin2C = sin(2.*asin(sinC));
		double px = (sin2A * x1 + sin2B * x2 + sin2C * x3) / (sin2A + sin2B + sin2C);
		double py = (sin2A * y1 + sin2B * y2 + sin2C * y3) / (sin2A + sin2B + sin2C);

		double s = fabs(crossabz) / 2.;
		double r = a * b * c / (4. * s);

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