[백준] 1002번: 터렛 (파이썬)


[백준] 1002번: 터렛 (파이썬)

#백준 #단계별로풀어보기 #파이썬 #Python #python #14단계 #기하1단계 > #1002번: 터렛 import sys T = int(sys.stdin.readline()) for _ in range(T): x1,y1,r1,x2,y2,r2 = list(map(int, sys.stdin.readline().split())) Add = (r1+r2)**2 Sub = (r1-r2)**2 Dist = (x2-x1)**2 + (y2-y1)**2 # 좌표가 같고, 거리가 같은 경우: 무한대 if (Dist == 0) and (Sub == 0): print(-1) # 교점이 1 개 elif (Dist == Add) or (Dist == Sub): print(1) # 교점이 2 개 elif (Sub < Dist) and (Dist < Add): print(2) # 교점이 0 개 else: print(0) 교점이 무한대인 경우를 먼저 확인했어요. 이후에는 교점이 1개, 2개, 0개인 조건문...


#1002번 #14단계 #Python #기하1단계 #단계별로풀어보기 #백준 #파이썬

원문링크 : [백준] 1002번: 터렛 (파이썬)