0023 - Circles Intersection

#include <cmath>
#include <iostream>
using namespace std;

void Slove(int n)	{
	double xa, ya, ra, xb, yb, rb;

	for (int i=0; i<n; ++i)	{
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double center=sqrt( pow(xa-xb,2)+pow(ya-yb,2) );
		if (center > ra+rb)	cout << 0 << endl;
		else if (ra > center+rb)	cout << 2 << endl;
		else if (rb > center+ra)	cout << -2 << endl;
		else	cout << 1 << endl;
	}
}

int main(void)	{
	int n;

	cin >> n;
	Slove(n);
	return 0;
}

図描けば一発だった。
2点間の距離とそれぞれの半径で条件分け