Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def result_coord(co_a1, co_b1, co_a2, co_b2, co_a3, co_b3, co_a4, co_b4):
- p1 = [co_a1, co_b1]
- q1 = [co_a2, co_b2]
- p2 = [co_a3, co_b3]
- q2 = [co_a4, co_b4]
- dist1 = math.dist(p1, q1)
- dist2 = math.dist(p2, q2)
- if dist1 >= dist2 :
- distToCenter1 = math.hypot(co_a1, co_b1)
- distToCenter2 = math.hypot(co_a2, co_b2)
- result = f"({math.floor(co_a1)}, {math.floor(co_b1)})({math.floor(co_a2)}, {math.floor(co_b2)})" \
- if distToCenter1 <= distToCenter2 else f"({math.floor(co_a2)}, {math.floor(co_b2)})({math.floor(co_a1)}, {math.floor(co_b1)})"
- else:
- distToCenter1 = math.hypot(co_a3, co_b3)
- distToCenter2 = math.hypot(co_a4, co_b4)
- result = f"({math.floor(co_a3)}, {math.floor(co_b3)})({math.floor(co_a4)}, {math.floor(co_b4)})" \
- if distToCenter1 <= distToCenter2 else f"({math.floor(co_a4)}, {math.floor(co_b4)})({math.floor(co_a3)}, {math.floor(co_b3)})"
- return result
- co_x1, co_y1, co_x2, co_y2, co_x3, co_y3, co_x4, co_y4 = float(input()),\
- float(input()), float(input()), float(input()), float(input()), float(input()), float(input()), float(input())
- print(result_coord(co_x1, co_y1, co_x2, co_y2, co_x3, co_y3, co_x4, co_y4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement