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