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