Advertisement
OIQ

kek

OIQ
Dec 26th, 2019
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5.  
  6. int main() {
  7.  
  8.     ll n, a, b, c;
  9.     cin >> n >> a >> b >> c;
  10.  
  11.     while (a > 0 || b > 0 || c > 0) {
  12.         if (b > 0) {
  13.             n++;
  14.             n /= 2;
  15.             b--;
  16.             continue;
  17.         }
  18.         if (a > 0) {
  19.             n /= 2;
  20.             a--;
  21.             continue;
  22.         }
  23.         if (c > 0) {
  24.             n--;
  25.             c--;
  26.             n /= 2;
  27.             continue;
  28.         }
  29.     }
  30.  
  31.     cout << n;
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement