목차

터렛

ps
링크acmicpc.net/…
출처BOJ
문제 번호1002
문제명터렛
레벨실버 4
분류

기하

시간복잡도O(1)
사용한 언어Python
제출기록29200KB / 88ms
최고기록52ms
해결날짜2021/09/25

풀이

코드

"""Solution code for "BOJ 1002. 터렛".

- Problem link: https://www.acmicpc.net/problem/1002
- Solution link: http://www.teferi.net/ps/problems/boj/1002
"""


def main():
    T = int(input())
    for _ in range(T):
        x1, y1, r1, x2, y2, r2 = [int(x) for x in input().split()]
        dist = (x1 - x2) ** 2 + (y1 - y2) ** 2
        r_sum, r_diff = (r1 + r2) ** 2, (r1 - r2) ** 2
        if dist == 0 and r1 == r2:
            print('-1')
        elif r_diff < dist < r_sum:
            print('2')
        elif dist in (r_diff, r_sum):
            print('1')
        else:
            print('0')


if __name__ == '__main__':
    main()