RT
自己怎么找也找不到哪错了
所以出来问大佬惹ww
希望大佬能给我一只手(雾
以下是代码:
#include<iostream>
#include<stack>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
stack<unsigned long long int> a;
int n, m;
cin >> n;
for (int i = 0; i < n; i++) {
while (!a.empty()) {
a.pop();
}
int t = 0;
cin >> t;
for (int j = 0; j < t; j++) {
string s;
int temp;
cin >> s;
if (s == "push") {
cin >> temp;
a.push(temp);
}
else if (s == "pop") {
if (a.empty()) {
cout << "Empty\n";
}
else {
a.pop();
}
}
else if (s == "query") {
if (a.empty()) {
cout << "Anguei!\n";
}
else {
cout << a.top() << endl;
}
}
else if (s == "size") {
cout << a.size() << endl;
}
}
}
}