蒟蒻33分求助 玄关。B3614
  • 板块灌水区
  • 楼主ztyo_zysclown
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/8/21 15:57
  • 上次更新2023/11/3 02:13:25
查看原帖
蒟蒻33分求助 玄关。B3614
947854
ztyo_zysclown楼主2023/8/21 15:57
#include<bits/stdc++.h>
using namespace std;
string a;
unsigned long long n;
unsigned long long o;
int main(){
	cin>>n;
	while(n--){
	    stack<unsigned long long> s;
		cin>>o;
		while(o--){
			cin>>a;
			if(a=="push"){
				int X;
				cin>>X;
				s.push(X);
			}
			if(a=="pop"){
				if(s.empty()==1){
					cout<<"Empty"<<endl;
				}
				else{
					s.pop();
				}
			}
			if(a=="query"){
				if(s.empty()==1){
					cout<<"Anguei!"<<endl;
				}
				else{
					cout<<s.top()<<endl;
				}
			}
			if(a=="size"){
				cout<<s.size()<<endl;
			}
		}
	}
	return 0;
}
2023/8/21 15:57
加载中...