为什么0分还带了个MLE?
查看原帖
为什么0分还带了个MLE?
1252442
lucy2012楼主2024/6/1 21:41
#include<bits/stdc++.h>
using namespace std;
long long t,n,num;
string st; 
int main(){
	cin>>t;
	while(t--){
		stack<int> s; 
		cin>>n;
		while(n--){
			cin>>st;
			if(st=="push"){
				cin>>num;
				s.push(num);
			}else if(st=="pop"){
				if(s.empty())
				    cout<<"Empty"<<endl;
				else
				    s.pop();
			}else if(st=="query"){
				if(s.empty())
				    cout<<"Anguei!"<<endl;
				else
				    cout<<s.top();
			}else if(st=="size")
			    cout<<s.size()<<endl;
		}
	} 
	return 0;
}	 
2024/6/1 21:41
加载中...