1002번: 터렛
각 테스트 케이스마다 류재명이 있을 수 있는 위치의 수를 출력한다. 만약 류재명이 있을 수 있는 위치의 개수가 무한대일 경우에는 -1을 출력한다.
www.acmicpc.net
import math
t = int(input())
for _ in range(t):
x1, y1, r1, x2, y2, r2 = map(int,input().split())
distance = math.sqrt((x2-x1)**2 + (y2-y1)**2)
if x1 == x2 and y1 == y2:
if r1 == r2:
print(-1)
else:
print(0)
continue
if r1 > distance + r2 or r2 > distance + r1 or distance > r1 + r2:
print(0)
elif r1 == distance + r2 or r2 == distance + r1 or r1 + r2 == distance:
print(1)
else:
print(2)
반응형
'알고리즘 공부 > 기타' 카테고리의 다른 글
[백준] 10870번 피보나치 수 5 (0) | 2021.05.12 |
---|---|
[백준] 10872번 팩토리얼 (0) | 2021.05.12 |
[백준] 3053번 택시 기하학 - 파이썬 (0) | 2021.05.11 |
[백준] 4153번 직각삼각형 - 파이썬 (0) | 2021.05.11 |
[백준] 3009번 네 번째 점 - 파이썬 (0) | 2021.05.11 |