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):
- firstTriangleSide1 = math.fabs(co_a1 - co_a2)
- firstTriangleSide2 = math.fabs(co_b1 - co_b2)
- firstDist = math.hypot(firstTriangleSide1, firstTriangleSide2)
- secondTriangleSide1 = math.fabs(co_a3 - co_a4)
- secondTriangleSide2 = math.fabs(co_b3 - co_b4)
- secondDist = math.hypot(secondTriangleSide1, secondTriangleSide2)
- if firstDist >= secondDist :
- 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 = float(input())
- co_y1 = float(input())
- co_x2 = float(input())
- co_y2 = float(input())
- co_x3 = float(input())
- co_y3 = float(input())
- co_x4 = float(input())
- co_y4 = 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