专栏文章

B3614

个人记录参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@mioxu920
此快照首次捕获于
2025/12/03 02:55
3 个月前
此快照最后确认于
2025/12/03 02:55
3 个月前
查看原文
CPP
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
const int N=1e5+50;
ull n,t;
int main(){
	cin>>t;
	while(t--){
		cin>>n;
        stack<ull>st;
		while(n--){
			string s;
			cin>>s;
			ull x;
			if(s[0]=='p'&&s[1]=='u'){
				cin>>x;
				st.push(x);
			}else if(s[0]=='p'&&s[1]=='o'){
				if(st.empty()) cout<<"Empty"<<'\n';
				else st.pop();
			}else if(s[0]=='q'){
				if(st.empty()) cout<<"Anguei!"<<'\n';
				else cout<<st.top()<<'\n';
			}else cout<<st.size()<<'\n';
		}
	}
	return 0;
}

评论

0 条评论,欢迎与作者交流。

正在加载评论...