# 13980 - CPP_practice >author: Utin ###### tags: `Data Structure` --- ## Brief See the code below ## Solution 0 ```c= #include <iostream> #include <vector> int main() { std::vector<int> V; int v1, v2; while (std::cin >> v1 >> v2) { switch(v1) { case 0: V.push_back(v2); break; case 1: V.front() += V.back() + v2; V.pop_back(); break; case 2: V.back() += V.front() + v2; } } std::cout << V.front() << ' ' << V.back() << '\n'; } // By Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up