rt
一开始我用DEV编译错误,但是不知道错在哪,后来用洛谷IDE试了一下发现可以,提交之后就AC了
报错信息: ld returned 1 exit status
#include<bits/stdc++.h>
using namespace std;
vector<unsigned long long>a;
int t,n;
unsigned long long k;
string b;
int main()
{
cin>>t;
while(t--)
{
n=0;
while(!a.empty())
{
a.pop_back();
}
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>b;//操作命令
if(b=="push")
{
cin>>k;
a.push_back(k);
}
else if(b=="pop")
{
if(!a.empty())
{
a.pop_back();
}
else
{
printf("Empty\n");
}
}
else if(b=="query")
{
if(!a.empty())
{
cout<<a[a.size()-1]<<endl;
}
else
{
printf("Anguei!\n");
}
}
else if(b=="size")
{
cout<<a.size()<<endl;
}
}
}
return 0;
}