33分求助
查看原帖
33分求助
664234
I_AM_THREE_BODY_MAN楼主2023/5/16 17:29

为什么33分? 请各位大佬帮助 代码如下:

#include<bits/stdc++.h>
using namespace std;
string str;
long long p,t,tt;
stack<int>s;
int main(){
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>tt;
		for(int j=1;j<=tt;j++){
			cin>>str;
			if(str=="push"){
				cin>>p;
				s.push(p);
			}
			else if(str=="query"){
				if(s.size()) cout<<s.top()<<"\n";
				else cout<<"Anguei!"<<"\n";
			}
			else if(str=="pop"){
				if(s.size()) s.pop();
				else cout<<"Empty"<<"\n";
			}
			else if(str=="size") cout<<s.size()<<"\n";
        }
    }
    return 0;
}

大粉福

2023/5/16 17:29
加载中...