Advertisement
Danila_lipatov

STASS

Oct 16th, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. def check_sec(main1, main2, add1, add2):
  2. return int(main1 / main2 == add1 / add2 or main1 / main2 == add2 / add1)
  3.  
  4.  
  5. def check(arr):
  6. a, b, c, d = arr
  7. ans = 0
  8. if a + b < c + d and a + b + c > d and a + b + d > c: # a + b is BC
  9. ans = max(check_sec(c, d, a, b), ans)
  10. print(check_sec(c, d, a, b))
  11. print("Here 1", check_sec(c, d, a, b))
  12. elif a + b > c + d and a + c + d > b and b + c + d > a: # c + d is BC
  13. ans = max(check_sec(a, b, c, d), ans)
  14. print("Here 2", check_sec(a, b, c, d))
  15.  
  16. if a + c < b + d and a + c + b > d and a + c + d > b: # a + c is BC
  17. ans = max(check_sec(b, d, a, c), ans)
  18. print("Here 3", check_sec(b, d, a, c))
  19. elif a + c > b + d and a + b + d > c and b + d + c > a: # b + d is BC
  20. ans = max(check_sec(a, c, b, d), ans)
  21. print("Here 4", check_sec(a, c, b, d))
  22.  
  23. if a + d < b + c and a + d + b > c and a + d + c > b: # a + d is BC
  24. ans = max(check_sec(b, c, a, d), ans)
  25. print("Here 5", check_sec(b, c, a, d))
  26. elif a + d > b + c and a + b + c > d and d + b + c > a: # b + c is BC
  27. ans = max(check_sec(a, d, b, c), ans)
  28. print("Here 6", check_sec(a, d, b, c))
  29.  
  30. return ans
  31.  
  32.  
  33. a = []
  34. for i in range(4):
  35. b = int(input())
  36. # print(b)
  37. a.append(b)
  38.  
  39. print(check(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement