Advertisement
1nikitas

Untitled

Oct 16th, 2019
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     long long int n;
  10.     double a, b, maximum,r;
  11.     cin >> n >> a >> b >> maximum;
  12.     if (b == 1)
  13.     {
  14.         long long int r1 = (long long int)(maximum/a);
  15.         cout << min(n, r1);
  16.         return 0;
  17.     }
  18.     r = (log(((maximum*(b-1))/a)+1))/(log(b));
  19.     long long int r2 = ((long long int)r);
  20.     cout << min(n, r2);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement