Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

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

using namespace std;

int main() {
	int n;
	
	cin >> n;
	
	while (n>0) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double xp = ((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 yp = ((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 r = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
		
		printf("%.3f %.3f %.3f\n", xp, yp, r);
		
		n--;
	}
	
	return 0;
}

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 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X = 0.5*(a*a*d - b*b*c) / (a*d - b*c) + (c*d*(d - c) / 2);
		Y = -b*(X - b / 2) / d+d/2;
		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("%.3f %.3f %.3f\n", X / 1000, Y / 1000, R / 1000);
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
typedef complex<double> P;

int n;
double x,y,xx,yy,xxx,yyy;
P a,b,c;

double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

P insect(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

int main(){
	cin>>n;
	while(n--){
		cin>>x>>y>>xx>>yy>>xxx>>yyy;
		P a=P(x,y),b=P(xx,yy),c=P(xxx,yyy);
		P ab=(a+b)*0.5,bc=(b+c)*0.5;
		P ab2=ab+(a-ab)*P(0,1),bc2=bc+(b-bc)*P(0,1);
		P p=insect(ab,ab2,bc,bc2);
		printf("%.3f %.3f %.3f\n",p.real(),p.imag(),abs(p-a));
	}
}

C++: #include <iostream>
#include <cmath>
#include <stdio.h>

using namespace std;

struct point{
     double x, y;
};

void renritu(point p1, point p2, double *a, double *b, double *c){
    *a=2*(p2.x-p1.x);
    *b=2*(p2.y-p1.y);
    *c=p1.x*p1.x+p1.y*p1.y-(p2.x*p2.x+p2.y*p2.y);
}

int main(void){
    int i,n;
    point p1,p2,p3;
    cin >> n;
    for(i=0;i<n;i++){
        double a1,b1,c1,a2,b2,c2,r;
        cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
        renritu(p1,p2,&a1,&b1,&c1);
        renritu(p2,p3,&a2,&b2,&c2);
        p3.x=-(b2-a2)*c1/(a1*b2-a2*b1);
        p3.y=-(a1-b1)*c2/(a1*b2-a2*b1);
        r=sqrt((p3.x-p1.x)*(p3.x-p1.x)+(p3.y-p1.y)*(p3.y-p1.y));
        printf("%.3lf %.3lf %.3lf\n",round(p3.x*1000)/1000,round(p3.y*1000)/1000, round(r*1000)/1000);
    }
    return 0;
}

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

using namespace std;

int main() {
  int n;
  double x1, x2, x3, y1, y2, y3, x, y,
         a1, b1, c1, a2, b2, c2, 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 = 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 = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
    printf("%.3lf %.3lf %.3lf\n", x, y, r);
  }

  return 0;
}

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

struct Line {
  double a;
  double b;
  double c;
};

typedef pair<double, double> Pair;

int n;
double xs[3];
double ys[3];

double Dist(Pair p1, Pair p2) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return sqrt(dx*dx+dy*dy);
}

Pair Intersect(Line &l1, Line &l2) {
  double a1 = l1.a;
  double b1 = l1.b;
  double c1 = l1.c;
  double a2 = l2.a;
  double b2 = l2.b;
  double c2 = l2.c;
  double x = (b1*c2 - b2*c1)/(a1*b2-a2*b1);
  double y = (a1*c2 - a2*c1)/(a2*b1-a1*b2);
  return Pair(x, y);
}

int main() {
  scanf("%d", &n);
  while (n--) {
    for (int i=0; i<3; i++) {
      scanf("%lf%lf", &xs[i], &ys[i]);
    }

    Line l1, l2;
    l1.a = xs[1]-xs[0];
    l1.b = ys[1]-ys[0];
    l1.c = -(xs[1]*xs[1]-xs[0]*xs[0] + ys[1]*ys[1]-ys[0]*ys[0])/2;
    l2.a = xs[1]-xs[2];
    l2.b = ys[1]-ys[2];
    l2.c = -(xs[1]*xs[1]-xs[2]*xs[2] + ys[1]*ys[1]-ys[2]*ys[2])/2;
    Pair p = Intersect(l1, l2);
    double r = Dist(p, Pair(xs[0], ys[0]));
    p.first = int(p.first*1000)/1000.0;
    p.second = int(p.second*1000)/1000.0;
    r = int(r*1000)/1000.0;
    printf("%.3f %.3f %.3f\n", p.first, p.second, r);
  }
}

C++: #include <iostream>

int main(){
  int n;
  double a,b,c,d,e,f;
  double x1,x2,x3,y1,y2,y3;
  double px,py;
  double r;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a = (x2-x1)*2.0;
    b = (y2-y1)*2.0;
    c = (x2*x2 + y2*y2 - x1*x1 - y1*y1);
    d = (x3-x1)*2.0;
    e = (y3-y1)*2.0;
    f = (x3*x3 + y3*y3 - x1*x1 - y1*y1);
    px = (c*e-b*f)/(a*e-b*d);
    py = (a*f-c*d)/(a*e-b*d);
    r = sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1));
    printf("%.3f %.3f %.3f\n",px,py,r);



  }

  return 0;
}

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

int main(){
	double n,a,b,c,d,e,f,x,y,r;
	
	cin >> n ;
	for(int turn=0;turn<n;turn++){
		cin >> a >> b >> c >> d >> e >> f;
		x=((c-a)*(e*e+f*f-a*a-b*b)-(e-a)*(c*c+d*d-a*a-b*b))/(2*((f-b)*(c-a)-(e-a)*(d-b)));
		y=((f-b)*(c*c+d*d-a*a-b*b)-(d-b)*(e*e+f*f-a*a-b*b))/(2*((f-b)*(c-a)-(e-a)*(d-b)));
		
		r=sqrt((x-a)*(x-a)+(y-b)*(y-b));
		
		printf("%.3f %.3f %.3f\n",x,y,r);
	}
return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a[2],b[2],c[2],m[2][2],inv[2][2],ans[2],x,y,det,r;
  int n;
  cin >>n;
  while(n--){
    cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1];
    b[0]-=a[0];
    b[1]-=a[1];
    c[0]-=a[0];
    c[1]-=a[1];
    m[0][0] = 2*b[0];
    m[1][0] = 2*b[1];
    m[0][1] = 2*c[0];
    m[1][1] = 2*c[1];
    ans[0] = b[0]*b[0]+b[1]*b[1];
    ans[1] = c[0]*c[0]+c[1]*c[1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][1] = m[0][0]/det;
    x = ans[0]*inv[0][0]+ans[1]*inv[1][0];
    y = ans[0]*inv[0][1]+ans[1]*inv[1][1];
    r = sqrt(x*x+y*y);
    x+=a[0];
    y+=a[1];
    printf("%.3lf %.3lf %.3lf\n",x,y,r);
  }
  return 0;
}