0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 16:56:26 +00:00
OI-codes/Luogu/B3614/B3614.cpp

53 lines
1.0 KiB
C++

#include <iostream>
#include <stack>
using std::cin;
using std::cout;
const char endl = '\n';
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
std::stack<unsigned long long> st;
cin >> n;
while (n--) {
std::string op;
cin >> op;
if (op == "push") {
unsigned long long x;
cin >> x;
st.emplace(x);
} else if (op == "pop") {
if (st.empty()) {
cout << "Empty" << endl;
} else {
st.pop();
}
} else if (op == "query") {
if (st.empty()) {
cout << "Anguei!" << endl;
} else {
cout << st.top() << endl;
}
} else if (op == "size") {
cout << st.size() << endl;
}
}
}
return 0;
}