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 <math.h>
#include <stdio.h>

int main(){

	double x1,y1,x2,y2,x3,y3;
	double a,b,c,x,y;
	double n,px,py,r;
	
	std::cin >> n;
	
	while(n--){
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		
		a = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
		b = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
		c = sqrt(pow(x3-x1,2) + pow(y3-y1,2));
		
		x = ((a*a)-((b*b)+(c*c)))/(-2*b*c);
		y = sqrt(1-x*x);
		r = a/(2*y);
		px = ((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));
		py = ((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));
		
		printf("%.3f %.3f %.3f\n", px, py, 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;

	cin >> n;

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

		a = x2 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X =0.5*((a*a*d - b*b*c)+(c*d*(d-c)) )/ (a*d - b*c);
		Y = 0.5*(a*b*(a - b) + (b*c*c - a*d*d)) / (b*c - a*d);
		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 = -R;
		R = (int)(R * 1000 + 0.5);

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

	return 0;
}

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

struct Point {
	double x, y;
};

double roundDig(double, int);

int main ()
{
	int num;
	Point a, b, c, p, mb, mc;
	double r;

	scanf("%d", &num);
	
	for (int i=0; i<num; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
		double A1 = 2 * (b.x - a.x), B1 = 2 * (b.y - a.y), C1 = a.x*a.x - b.x*b.x + a.y*a.y - b.y*b.y,
			   A2 = 2 * (c.x - a.x), B2 = 2 * (c.y - a.y), C2 = a.x*a.x - c.x*c.x + a.y*a.y - c.y*c.y;
		
		p.x = (B1*C1 - B2*C1) / (A1*B2 - A2*B1);
		p.y = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);
		
		mb.x = (a.x + b.x) / 2; mb.y = (a.y + b.y) / 2;
		mc.x = (a.x + c.x) / 2; mc.y = (a.y + c.y) / 2;
		
		r = sqrt((p.x - a.x)*(p.x - a.x) + (p.y - a.y)*(p.x - a.y));
		 
		printf("%.3lf %.3lf %.3lf\n", roundDig(p.x, 4), roundDig(p.y, 4), r);
	}
	
    return 0;
}

double roundDig(double n, int dig)
{
	int multi = pow(10, dig);
	
	return (floor(n*multi + 5) / multi);
}

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;

	cin >> n;

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

		a = x2 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X = 0.5*((a*a*d - b*b*c) + c*d*(d - c)) / (a*d - b*c);
		Y = 0.5*(a*b*(a - b) + (b*c*c - a*d*d)) / (b*c - a*d);
		R = sqrt((X - a)*(X - a) + (Y - a)*(Y - a));

		//?°???°????¬¬??????????????¨?????\
		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 = -R;
		R = (int)(R * 1000 + 0.5);

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


	return 0;
}

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

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;n++){
		double ax,ay,bx,by,cx,cy,radab,radac,radc,r,bc;
		cin>>ax>>ay>>bx>>by>>cx>>cy;
		radab=atan2(by-ay,bx-ax);
		radac=atan2(cy-ay,cx-ax);
		radc=radac-radab;
		if(radc>M_PI_2)radc=M_PI-radc;
		bc=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by));
		r=bc/sin(radc)/2;
		printf("%.3f %.3f %.3f\n",ax+r*cos(radc+radab),ay+r*sin(radc+radab),r);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double inp,a,b,c,d,e,f,x,y,r;
	vector<vector<double> > xy;

	cin>>n;
	xy.reserve(n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
		{
			cin>>inp;
			xy[i].push_back(inp);
		}
		a=2*(xy[i][x2]-xy[i][x1]);
		b=2*(xy[i][y2]-xy[i][y1]);
		c=2*(xy[i][x3]-xy[i][x2]);
		d=2*(xy[i][y3]-xy[i][y2]);
		e=xy[i][y2]*xy[i][y2]-xy[i][y1]*xy[i][y1]+xy[i][x2]*xy[i][x2]-xy[i][x1]*xy[i][x1];
		f=xy[i][y3]*xy[i][y3]-xy[i][y2]*xy[i][y2]+xy[i][x3]*xy[i][x3]-xy[i][x2]*xy[i][x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt(pow(xy[i][x1]-x,2)+pow(xy[i][y1]-y,2));

		x+=0.0005;
		y+=0.0005;
		r+=0.0005;

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

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
    double x1,y1,x2,y2,x3,y3;
    int n;
    while(n--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
         double  d1 = x1*x1+y1*y1;
      double  d2 = x2*x2+y2*y2;
      double  d3 = x3*x3+y3*y3;
      double  u = 0.5/(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3);
      double  xp = u*(d1*y2-d2*y1+d2*y3-d3*y2+d3*y1-d1*y3);
      double  yp = u*(x1*d2-x2*d1+x2*d3-x3*d2+x3*d1-x1*d3);
      double  r = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
      printf("%.3f %.3f %.3f\n",xp,yp,r);
    }



    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
  int n=0;
  double ax,ay,bx,by,cx,cy,S,R,a,b,c,x=0,y=0;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    S=((bx-ax)*(cy-ay)-(cx-ax)*(by-ay))/2;
    a=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
    b=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by));
    c=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
    R=a*b*c/(4*S);
    x=(a*a*(b*b+c*c-a*a)*ax+b*b*(c*c+a*a-b*b)*bx+c*c*(a*a+b*b-c*c)*cx)/(16*S*S);
    y=(a*a*(b*b+c*c-a*a)*ay+b*b*(c*c+a*a-b*b)*by+c*c*(a*a+b*b-c*c)*cy)/(16*S*S);
    cout<<x<<" "<<y<<" "<<R<<endl;
  }
}