Advertisement
bl00dt3ars

03. Longer Line

Jun 14th, 2021
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. import math
  2.  
  3.  
  4. def get_distance(a, b, c, d):
  5.     a = math.pow(a, 2)
  6.     b = math.pow(b, 2)
  7.     c = math.pow(c, 2)
  8.     d = math.pow(d, 2)
  9.     return math.sqrt(a + b + c + d)
  10.  
  11.  
  12. def get_calculation(a, b):
  13.     a = math.pow(a, 2)
  14.     b = math.pow(b, 2)
  15.     return math.sqrt(a + b)
  16.  
  17.  
  18. x1 = float(input())
  19. y1 = float(input())
  20. x2 = float(input())
  21. y2 = float(input())
  22. x3 = float(input())
  23. y3 = float(input())
  24. x4 = float(input())
  25. y4 = float(input())
  26.  
  27. first_line = get_distance(x1, y1, x2, y2)
  28. second_line = get_distance(x3, y3, x4, y4)
  29.  
  30. if first_line >= second_line:
  31.     if get_calculation(x1, y1) <= get_calculation(x2, y2):
  32.         print(f"({math.floor(x1)}, {math.floor(y1)})({math.floor(x2)}, {math.floor(y2)})")
  33.     else:
  34.         print(f"({math.floor(x2)}, {math.floor(y2)})({math.floor(x1)}, {math.floor(y1)})")
  35. else:
  36.     if get_calculation(x3, y3) <= get_calculation(x4, y4):
  37.         print(f"({math.floor(x3)}, {math.floor(y3)})({math.floor(x4)}, {math.floor(y4)})")
  38.     else:
  39.         print(f"({math.floor(x4)}, {math.floor(y4)})({math.floor(x3)}, {math.floor(y3)})")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement