Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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 <stdio.h>
#include <math.h>
&#160;
int main(){
&#160;&#160;&#160;&#160;int n;
&#160;&#160;&#160;&#160;scanf("%d", &n);
&#160;&#160;&#160;&#160;for(int i=0;i<n;i++){
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double x1,y1,x2,y2,x3,y3;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double x,y;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;double ax,ay,am,bx,by,bm;
&#160;
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(y1==y2){
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x = (x1+x2)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bx = (x2+x3)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;by = (y2+y3)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bm = -(x2-x3)/(y2-y3);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;y = bm*(x-bx)+by;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else if(y2==y3){
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x = (x2+x3)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ax = (x1+x2)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ay = (y1+y2)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;am = -(x1-x2)/(y1-y2);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;y = am*(x-ax)+ay;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ax = (x1+x2)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ay = (y1+y2)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;am = -(x1-x2)/(y1-y2);&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bx = (x2+x3)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;by = (y2+y3)/2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bm = -(x2-x3)/(y2-y3);
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x = (am*ax-bm*bx-ay+by)/(am-bm);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;y = am*(x-ax)+ay;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf("%.3lf %.3lf %.3lf\n", x, y, sqrt(pow(x1-x, 2)+pow(y1-y,2)));
&#160;&#160;&#160;&#160;}
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
 
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
 
    ret = cross(p1,p2)/2.0;
     
    return abs(ret);
}
 
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
         
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);
 
    }
    return 0;
}

C++: #include<cstdio>
#include<cmath>
int main()
{
	int n;
	scanf("%d", &n);
	while(n--)
	{
		double x1, y1, x2, y2, x3, y3;
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		double x4 = (x1 + x2) / 2, y4 = (y1 + y2) / 2, x5 = (x1 + x3) / 2, y5 = (y1 + y3) / 2;
		double a1, a2, b1, b2, c1, c2;
		if(x1 == x2)
		{
			a1 = 0.0;
			b1 = 1.0;
			c1 = y4;
		}
		else if(y1 == y2)
		{
			b1 = 0.0;
			a1 = 1.0;
			c1 = x4;
		}
		else
		{
			b1 = 1.0;
			a1 = - 1 / ((y2 - y1) / (x2 - x1));
			c1 = a1 * x4 + b1 * y4;
		}
		if(x1 == x3)
		{
			a2 = 0.0;
			b2 = 1.0;
			c2 = y5;
		}
		else if(y1 == y3)
		{
			b2 = 0.0;
			a2 = 1.0;
			c2 = x5;
		}
		else
		{
			b2 = 1.0;
			a2 = - 1 / ((y3 - y1) / (x3 - x1));
			c2 = a2 * x5 + b2 * y5;
		}
		double x11 = a1, x12 = b1, x13 = c1, x14 = a2, x15 = b2, x16 = c2;
		x11 *= b2;
		x13 *= b2;
		x14 *= b1;
		x16 *= b1;
		double t1 = (x13 - x16) / (x11 - x14);
		b1 *= a2;
		c1 *= a2;
		b2 *= a1;
		c2 *= a1;
		double t2 = (c1 - c2) / (b1 - b2);
		if(t1 == -0.0) t1 = 0.0;
		if(t2 == -0.0) t2 = 0.0;
		double t3 = sqrt((x1 - t1) * (x1 - t1) + (y1 - t2) * (y1 - t2));
		printf("%.3lf %.3lf %.3lf\n", t1, t2, t3);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

// 2直線の交点
P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // 交点がない
  return a1 + d1/d2 * (a2-a1);
}

// 三角形の外心。点a,b,cは同一線上にあってはならない
P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main() {
  int n;
  cin >> n;
  D x1,y1,x2,y2,x3,y3;
  rep(_,n) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    P a = P(x1,y1);
    P b = P(x2,y2);
    P c = P(x3,y3);
    P center = circumcenter(a,b,c);
    printf("%.6lf %.6lf %.6lf\n", center.X, center.Y, abs(center - a));
  }
  return 0;
}