diff --git a/Luogu/B3614/B3614.cpp b/Luogu/B3614/B3614.cpp new file mode 100644 index 00000000..fb6c2cf1 --- /dev/null +++ b/Luogu/B3614/B3614.cpp @@ -0,0 +1,52 @@ +#include +#include + +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 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; +}