Advertisement
bl00dt3ars

03. Longer Line

Jun 12th, 2021
195
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. def get_distance(a, b, c, d):
  4.     a = math.pow(a, 2)
  5.     b = math.pow(b, 2)
  6.     c = math.pow(c, 2)
  7.     d = math.pow(d, 2)
  8.     return math.sqrt(a + b + c + d)
  9.  
  10.  
  11. def get_calculation(a, b):
  12.     a = math.pow(a, 2)
  13.     b = math.pow(b, 2)
  14.     return math.sqrt(a + b)
  15.  
  16.  
  17. x1 = float(input())
  18. y1 = float(input())
  19. x2 = float(input())
  20. y2 = float(input())
  21. x3 = float(input())
  22. y3 = float(input())
  23. x4 = float(input())
  24. y4 = float(input())
  25.  
  26. first_line = get_distance(x1, y1, x2, y2)
  27. second_line = get_distance(x3, y3, x4, y4)
  28.  
  29. if first_line >= second_line:
  30.     if get_calculation(x1, y1) <= get_calculation(x2, y2):
  31.         print(f"({math.floor(x1)}, {math.floor(y1)})({math.floor(x2)}, {math.floor(y2)})")
  32.     else:
  33.         print(f"({math.floor(x2)}, {math.floor(y2)})({math.floor(x1)}, {math.floor(y1)})")
  34. else:
  35.     if get_calculation(x3, y3) <= get_calculation(x4, y4):
  36.         print(f"({math.floor(x3)}, {math.floor(y3)})({math.floor(x4)}, {math.floor(y4)})")
  37.     else:
  38.         print(f"({math.floor(x4)}, {math.floor(y4)})({math.floor(x3)}, {math.floor(y3)})")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement