Advertisement
Bad_Programist

Untitled

Feb 3rd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. a, b, c, d = list(map(int, input().split()))
  2. for i in range(1, abs(d) + 1):
  3.     if d % i == 0:
  4.         if a * (i ** 3) + b * (i ** 2) + c * i + d == 0:
  5.             print(i)
  6.             break
  7.         elif a * ((-i) ** 3) + b * (i ** 2) + c * (-i) + d == 0:
  8.             print(-i)
  9.             break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement