SHARE
TWEET

Untitled

a guest Oct 16th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top