Advertisement
Guest User

C

a guest
Oct 16th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import math
  2.  
  3.  
  4. def main():
  5.     n, a1, b, mx = map(int, input().split())
  6.     x = None
  7.     if b > 1:
  8.         exp = (mx * (b - 1)) / a1 + 1
  9.         x = math.ceil(math.log(exp, b))
  10.     if b == 1:
  11.         x = round(mx/a1)+1
  12.     if x > n:
  13.         print(n)
  14.     else:
  15.         print(x-1)
  16.  
  17.  
  18. if __name__ == "__main__":
  19.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement