WA求调
  • 板块灌水区
  • 楼主Jerry_heng
  • 当前回复1
  • 已保存回复1
  • 发布时间2022/12/25 20:41
  • 上次更新2023/10/24 06:37:25
查看原帖
WA求调
763878
Jerry_heng楼主2022/12/25 20:41

https://www.luogu.com.cn/problem/B3614

#include<bits/stdc++.h>
#include<stack>
using namespace std;
stack<long long> s;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++){
			string st;
			cin>>st;
			if(st=="push"){
				int x;
				cin>>x;
				s.push(x);
			}
			if(st=="query"){
				if(!s.empty())cout<<s.top()<<endl;
				else cout<<"Anguei!"<<endl;
			}
			if(st=="size")cout<<s.size()<<endl;
			if(st=="pop"){
				if(!s.empty())s.pop();
				else cout<<"Empty"<<endl;
			}
		}
		while(!s.empty()){
			s.pop();
		}
	}
	return 0;
}
2022/12/25 20:41
加载中...