Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,x,k;
- stack<int> s;
- cin >> t;
- while(t--){
- cin >> k;
- if(k == 1){
- cin >> x;
- s.push(x);
- }else{
- cout << s.top() << endl;
- s.pop();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement