Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef long long int ll;
- int main() {
- ll n, a, b, c;
- cin >> n >> a >> b >> c;
- while (a > 0 || b > 0 || c > 0) {
- if (b > 0) {
- n++;
- n /= 2;
- b--;
- continue;
- }
- if (a > 0) {
- n /= 2;
- a--;
- continue;
- }
- if (c > 0) {
- n--;
- c--;
- n /= 2;
- continue;
- }
- }
- cout << n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement