[C]伯俊2581号-タレット-


質問する

コード#コード#
#include <stdio.h>	
#include <math.h>

int main(void) {
	int T, x1, y1, r1, x2, y2, r2, result, sum, minus;
	double distance;
	scanf("%d", &T);
	while (T--) {
		scanf("%d %d %d %d %d %d", &x1, &y1, &r1, &x2, &y2, &r2);
		distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
		sum = r1 + r2;
		minus = abs(r1 - r2);
		if (minus < distance && distance < sum) result = 2;
		else if (sum == distance || minus == distance && distance != 0) result = 1;
		else if (sum < distance || distance < minus) result = 0;
		else result = -1;
		printf("%d\n", result);
	}
}