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 <cstdio>
#include <cmath>
using namespace std;

double marume( double x ){
	long long t = x * 1000 + 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		y1 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - x2 * y1;
		double detX = dist1 * y2 - y1 * dist2;
		double detY = x1 * dist2 - dist1 * x1;
		double x = detX / detA;
		double y = detY / detA;
		double r = hypot(x, y);
		
		x += tx;
		y += ty;
		
		//x = marume(x);
		//y = marume(y);
		//r = marume(r);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

C++: 
// Circumscribed Circle of a Triangle


#include<stdio.h>
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
	int n;
	cin >> n;
	double x[3];
	double y[3];
	double r;

	while(n--){
	 for(int j=0;j<3;j++){
	 	cin >> x[j] >> y[j];
	 }

	 double a = 2*(x[1]-x[0]);
	 double b = 2*(y[1]-y[0]);
	 double c = 2*(x[2]-x[0]);
	 double d = 2*(y[2]-y[0]);

	 double e = pow(x[1],2.0)-pow(x[0],2.0)+pow(y[1],2.0)-pow(y[0],2.0);
	 double f = pow(x[2],2.0)-pow(x[0],2.0)+pow(y[2],2.0)-pow(y[0],2.0);

	 if(a==0){
	 	swap(a,c);
	 	swap(b,d);
	 	swap(e,f);
	 }

	b = b/a;
	e = e/a;
	a = a/a;
	 
	 
	d = d-b*c;
	f = f-e*c;
	c = c-a*c;

	f = f/d;
	d = d/d;

	b = b-d*b;
	e = e-f*b;

	r = sqrt(pow((e-x[0]),2.0)+pow((f-y[0]),2.0));
	
	cout << fixed;
	cout << setprecision(3) << e <<" "<< f << " " << r << endl;
	}
	return 0;

}

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

//#include<iostream>
using namespace std;

int main(){
	int n;
	float x1, y1, x2, y2, x3, y3, a1,b1,c1,a2,b2,c2;
	float xc, yc, r;

	scanf("%d", &n);
	while(n--){
		scanf("%f%f%f%f%f%f",&x1, &y1, &x2, &y2, &x3, &y3);
	
//	http://pegasus.infor.kanazawa-it.ac.jp/~koblab/home/d1504310/acm/asia/1997/97_C_Minimal_Circle.html

    a1=(x2-x1)*2;
    b1=(y2-y1)*2;
    c1=x1*x1-x2*x2+y1*y1-y2*y2;
    a2=(x3-x1)*2;
    b2=(y3-y1)*2;
    c2=x1*x1-x3*x3+y1*y1-y3*y3;
    xc=(b1*c2-b2*c1)/(a1*b2-a2*b1);
    yc=(c1*a2-c2*a1)/(a1*b2-a2*b1);
    r=sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc));
    printf("%.3f %.3f %.3f\n",xc,yc,r);
		
	}
	return 0;
}

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

#define ROUND_RANK 4
#define EPS 1e-8

using namespace std;

struct vec2
{
	double x;
	double y;
};

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& p11, const double& q2, const double& q1, const double& p21) {
	return ((p11*q2 - q1*p21) / det);
}
//rの解の算出
double Calc_r(const double& x0, const double& y0, const double& x1, const double& y1) {
	double r;
	r = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
	return r;
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	int n;
	vec2 ver[20][3];

	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> ver[i][j].x;
			cin >> ver[i][j].y;
		}
	}
	double p11, p12, p21, p22, q1, q2;
	double  det;//行列式
	double	x, y, r;//解
	for (int i = 0; i < n; ++i) {
		p11 = -2*(ver[i][0].x - ver[i][1].x);
		p12 = -2*(ver[i][0].y - ver[i][1].y);
		p21 = -2*(ver[i][1].x - ver[i][2].x);
		p22 = -2*(ver[i][1].y - ver[i][2].y);
		q1 = (ver[i][1].x + ver[i][0].x)*(ver[i][1].x - ver[i][0].x)
		   + (ver[i][1].y + ver[i][0].y)*(ver[i][1].y - ver[i][0].y);
		q2 = (ver[i][2].x + ver[i][1].x)*(ver[i][2].x - ver[i][1].x)
		   + (ver[i][2].y + ver[i][1].y)*(ver[i][2].y - ver[i][1].y);
		det = Calc_det(p11, p12, p21, p22);
		det = fabs(det);
		x = Calc_x(det, q1, p22, p12, q2);
		y = Calc_y(det, p11, q2, q1, p21);
		r = Calc_r(x, y, ver[i][0].x, ver[i][0].y);
		x = Round(x, ROUND_RANK);
		y = Round(y, ROUND_RANK);
		r = Round(r, ROUND_RANK);
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x + EPS << " " << y + EPS << " " << r + EPS <<endl;
	}
}

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

using namespace std;

int main(void){
	
	int n;
	double x[3]={0},y[3]={0},r,a,b,c,d[2]={0},e[2]={0},f[2]={0},l,m;

	cin>>n;

	for(int i=0;i<n;i++){
		
		a=b=c=r=l=m=0;
		for(int i=0;i<2;i++){
			d[i]=e[i]=f[i]=0;
		}
		for(int i=0;i<3;i++){
			x[i]=y[i]=0;
		}

		cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2];

		a=sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));	//ツ各ツ陛督づ個陳キツつウ
		b=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
		c=sqrt((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]));	
	
		r=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));			//ツ外ツ静堋円ツづ個板シツ径
		
		d[0]=2*(x[1]-x[0]);
		e[0]=2*(y[1]-y[0]);
		f[0]=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
		d[1]=2*(x[2]-x[0]);
		e[1]=2*(y[2]-y[0]);
		f[1]=x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];

		l=(e[0]*f[1]-e[1]*f[0])/(d[0]*e[1]-d[1]*e[0]);
		m=(f[0]*d[1]-f[1]*d[0])/(d[0]*e[1]-d[1]*e[0]);

		l=l*1000;
		l=l+0.5;
		l=int(l);
		l=l/1000;

		m=m*1000;
		m=m+0.5;
		m=int(m);
		m=m/1000;

		r=r*1000;
		r=r+0.5;
		r=(int)(r);
		r=r/1000;
		
		printf("%.03lf %.03lf %.03lf\n",l,m,r);
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    double x1, y1, x2, y2, x3, y3;
    double a1, a2, b1, b2, c1, c2;
    double x, y, r;

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

        a1 = 2 * (x2 - x1);
        b1 = 2 * (y2 - y1);
        c1 = sqrt(x1) - sqrt(x2) + sqrt(y1)  - sqrt(y2);
        a2 = 2 * (x3 - x1);
        b2 = 2 * (y3 - y1);
        c2 = sqrt(x1) - sqrt(x3) + sqrt(y1)  - sqrt(y3);

        x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = pow(sqrt(abs(x - x1)) + sqrt(abs(y - y2)), 2);

        cout << setprecision(3) << fixed;
        cout << x << " " << y << " " << r << " " << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int n;
  double x[3],y[3];
  cin >> n;
  for(int i=0;i<n;i++){
    for(int i=0;i<3;i++) cin >> x[i] >> y[i];
    double a1 = 2 * (x[1] - x[0]);
    double b1 = 2 * (y[1] - y[0]);
    double c1 = x[0] * x[0] - x[1] * x[1] + y[0] * y[0] - y[1] * y[1];
    double a2 = 2 * (x[2] - x[0]);
    double b2 = 2 * (y[2] - y[0]);
    double c2 =  x[0] * x[0] - x[2] * x[2] + y[0] * y[0] - y[2] * y[2];
    double ansx = (b1*c2-b2*c1)/(a1*b2-a2*b1);
    double ansy = (c1*a2-c2*a1)/(a1*b2-a2*b1);
    double ans = sqrt((ansx-x[0])*(ansx-x[0])+(ansy-y[0])*(ansy-y[0]));
    cout << fixed << setprecision(3) << ansx << ' ' << ansy << ' ' << ans << endl;
  }
  return 0;
}