求助,第三个点挖了
查看原帖
求助,第三个点挖了
601639
fkcufk楼主2023/3/29 18:45
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
stack<ll> s;
string str;
ll T,n,x;
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin >> T;
    while(T--){
        cin >> n;
        while(n--){
            cin >> str;
            if(str[0]=='p'&&str[1]=='u'){
                cin >> x;
                s.push(x);
            }
            if(str[0]=='p'&&str[1]=='o'){
                if(s.empty()) cout << "Empty\n";
                else s.pop();
            }
            if(str[0]=='q'){
                if(s.empty()) cout << "Anguei!\n";
                else cout << s.top() << endl;
            }
            if(str[0]=='s') cout << s.size() << endl;
            //cout << endl;
        }
    }
    return 0;
}
2023/3/29 18:45
加载中...