본문 바로가기

백준(BOJ) 풀이

[백준 1002] 터렛

n=int(input())

 

for i in range(n):

    x,y,r,X,Y,R=map(int, input().split())

    if x==X and y==Y and r==R:

        print(-1)

    elif x==X and y==Y and r!=R:

        print(0)

    else :

        powerofD=(x-X)**2 +(y-Y)**2

        if (R+r)**2<powerofD:

            print(0)

        elif (R+r)**2==powerofD:

            print(1)

        elif (R+r)**2>powerofD and (abs(R-r))**2<powerofD:

            print(2)

        elif (abs(R-r))**2==powerofD:

            print(1)

        else :

            print(0)

 

#수 비교할 때, 정수 범위에서 되도록 주의를 하자.

'백준(BOJ) 풀이' 카테고리의 다른 글

[백준 2667] 단지 번호 붙이기  (0) 2019.11.12
[백준 1753] 최단경로  (0) 2019.11.12
[백준 17836] 공주님을 구해라  (0) 2019.11.10
[백준 1914] 하노이 탑  (0) 2019.11.10
[백준 15649] N과 M(1)  (0) 2019.11.10