2022.05.08에 푼 것


import sys
import math
T=int(sys.stdin.readline()) #test 횟수
for i in range(T):
x1, y1, x2, y2=map(int, sys.stdin.readline().split())
n=int(sys.stdin.readline())#n=행성의 개수
cnt=0#count 변수 초기화
for k in range(n):
cx,cy,r=map(int, sys.stdin.readline().split())
d1=math.sqrt((cx-x1)**2+(cy-y1)**2)
d2=math.sqrt((cx-x2)**2+(cy-y2)**2)
if (d1<r and d2>r) or (d2<r and d1>r):
cnt=cnt+1
print(cnt)
뭐.. 이건 어렵진 않은 문제니깐 설명은 생략한다.
여기서 생각해야할 가장 중요한 것은 시작점 도착점 두개 모두 같은 원 안에 들어있을때다!!!!!
두번이나 제출했는데 왜 계속 실패하나 고민좀 했던거같다😑
'Algorithm' 카테고리의 다른 글
[python] 백준 1003 : 피보나치 함수 (0) | 2023.05.19 |
---|---|
[python] 백준 1002번 : 터렛 (0) | 2023.05.19 |
[python] 백준 1007번 : 벡터 매칭 (0) | 2023.05.19 |
[python] 백준 2563번: 색종이 (0) | 2023.01.15 |
[python] 백준 2581번: 소수 (2) | 2023.01.14 |