From bad5f663732859315f8b1845f5d4969e747d7d3e Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sat, 20 Sep 2025 20:00:07 +0900 Subject: [PATCH] 20250920 baekjoon --- code_study/Baekjoon/python/1004.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 code_study/Baekjoon/python/1004.py diff --git a/code_study/Baekjoon/python/1004.py b/code_study/Baekjoon/python/1004.py new file mode 100644 index 0000000..069840f --- /dev/null +++ b/code_study/Baekjoon/python/1004.py @@ -0,0 +1,23 @@ +import sys + +input = sys.stdin.readline + +def pow_dist(x1, y1, x2, y2) : + return (x1-x2)**2 + (y1-y2)**2 + +for _ in range(int(input())) : + x1, y1, x2, y2 = map(int, input().split()) + + count = 0 + for _ in range(int(input())) : + cx, cy, cr = map(int, input().split()) + dist1 = pow_dist(x1,y1,cx,cy) + dist2 = pow_dist(x2,y2,cx,cy) + pow_cr = cr**2 + + if pow_cr > dist1 and pow_cr > dist2 : + pass + elif pow_cr > dist1 or pow_cr > dist2 : + count += 1 + + print(count) \ No newline at end of file