0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00
Baoshuo Ren 2021-08-03 21:22:28 +08:00 committed by Baoshuo Ren
parent b7eb21c0f5
commit 03630f4f07
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

22
AcWing/828/828.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int m;
cin >> m;
stack<int> q;
while (m--) {
string op;
cin >> op;
if (op == "push") {
int x;
cin >> x;
q.push(x);
}
if (op == "pop") q.pop();
if (op == "empty") cout << (q.empty() ? "YES" : "NO") << endl;
if (op == "query") cout << q.top() << endl;
}
return 0;
}