Advertisement
EvaMoore

c_1

Oct 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int a1, b, max = 0, n, k = 0;
  5. cin >> n >> a1 >> b >> max;
  6. while (n != 0 && (max - a1) >= 0) {
  7. max -= a1;
  8. a1 = a1 * b;
  9. n--;
  10. k++;
  11. }
  12. cout << k;
  13. return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement