Advertisement
Onesible

Cartesian

Oct 10th, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from math import floor, sqrt
  2.  
  3.  
  4. def cartesian_line(a, b, c, d):
  5.     point1 = floor(sqrt(a ** 2 + b ** 2))
  6.     point2 = floor(sqrt(c ** 2 + d ** 2))
  7.     line = point1 + point2
  8.     return line, point1, point2
  9.  
  10.  
  11. x_1, y_1, x_2, y_2 = int(input()), int(input()), int(input()), int(input())
  12. x_3, y_3, x_4, y_4 = int(input()), int(input()), int(input()), int(input())
  13. line1, point_x, point_y = cartesian_line(x_1, y_1, x_2, y_2)
  14. line2, point_z, point_v = cartesian_line(x_3, y_3, x_4, y_4)
  15. if line1 >= line2:
  16.     if abs(point_x) <= abs(point_y):
  17.         print(f'({x_1}, {y_1})({x_2}, {y_2})')
  18.     else:
  19.         print(f'({x_2}, {y_2})({x_1}, {y_1})')
  20. else:
  21.     if abs(point_z) <= abs(point_v):
  22.         print(f'({x_3}, {y_3})({x_4}, {y_4})')
  23.     else:
  24.         print(f'({x_4}, {y_4})({x_3}, {y_3})')
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement