Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def check_intersection(point1, r1, point2, r2):
- x1, y1 = point1
- x2, y2 = point2
- # Calculate distance between centers of the circles
- distance = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
- # Check if circles are equal
- if distance == 0 and r1 == r2:
- return True
- elif abs(r1-r2) <= distance <= abs(r1+r2):
- return True
- else:
- return False
- x1, y1, r1 = [float(i) for i in input().split()]
- x2, y2, r2 = [float(i) for i in input().split()]
- do_intersect = check_intersection((x1, y1), r1, (x2, y2), r2)
- print("YES" if do_intersect else "NO")
Advertisement
Add Comment
Please, Sign In to add comment