33分,wa了后面两个点
查看原帖
33分,wa了后面两个点
1189340
aishiteru_mitsu_ha楼主2024/3/21 18:01
#include<bits/stdc++.h>
using namespace std;
int a[114514],t,n,top;
string way;
void push(unsigned long long x);
int main(){
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>n;
        for(int j=1;j<=n;j++){
            cin>>way;
            if(way=="push"){
                unsigned long long m;
                cin>>m;
                push(m);
            }
            if(way=="pop"){
                if(!top){
                    cout<<"Empty"<<endl;
                }else{
                    --top;
                }
            }
            if(way=="size"){
                cout<<top<<endl;
            }
            if(way=="query"){
                if(!top){
                    cout<<"Anguei!"<<endl;
                }else{
                    cout<<a[top]<<endl;
                }
            }
        }
    }
    return 0;
}
void push(unsigned long long x){
    a[++top]=x;
}
2024/3/21 18:01
加载中...