66分求调QwQ
查看原帖
66分求调QwQ
1289352
YMS2333楼主2024/9/16 21:38
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	vector<unsigned long long> v;
	int t;
	cin>>t;
	string caozuo;
	unsigned long long temp;
	while(t--)
	{
		int n;
		cin>>n;
		for(int i=0;i<n;++i)
		{
			cin>>caozuo;
			if(caozuo=="push")
			{
				cin>>temp;
				v.push_back(temp);
			}
			if(caozuo=="pop")
			{
				if(v.size()!=0)
					v.pop_back();
				else
					cout<<"Empty"<<endl;
			}
			if(caozuo=="query")
			{
				if(v.size()!=0)
					cout<<v.back()<<endl;
				else
					cout<<"Anguei!"<<endl;
			}
			if(caozuo=="size")
			{
				cout<<v.size()<<endl;
			}
		}
	}
}
2024/9/16 21:38
加载中...