fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. ios::sync_with_stdio(false);
  7. cin.tie(nullptr); cout.tie(nullptr);
  8.  
  9. int n, k;
  10. cin >> n >> k;
  11.  
  12.  
  13. int i = 1;
  14. while (n--) {
  15. if (i + i < i + k) {
  16. i *= 2;
  17. } else {
  18. i = i + k;
  19. }
  20. }
  21.  
  22. cout << i;
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5284KB
stdin
10
10
stdout
76