Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- int main()
- {
- long long int n;
- double a, b, maximum,r;
- cin >> n >> a >> b >> maximum;
- if (b == 1)
- {
- long long int r1 = (long long int)(maximum/a);
- cout << min(n, r1);
- return 0;
- }
- r = (log(((maximum*(b-1))/a)+1))/(log(b));
- long long int r2 = ((long long int)r);
- cout << min(n, r2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement