QwQ_77 @ 2024-10-06 17:33:07
#include<bits/stdc++.h>
using namespace std;
int t;
int main()
{
cin>>t;
while(t--)
{
stack<int> s;
int n;
cin>>n;
while(n--)
{
string a;
cin>>a;
if(a=="push")
{
int x;
s.push(x);
}
if(a=="pop")
if(s.empty()==1)
cout<<"Empty"<<endl;
else
s.pop();
if(a=="query")
if(s.empty()==1)
cout<<"Anguei!"<<endl;
else
cout<<s.top()<<endl;
if(a=="size")
cout<<s.size()<<endl;
}
}
return 0;
}
by nzy0211 @ 2024-10-06 17:46:49
@QwQ_77 x<=2^64 所以用long long
求关注
by nzy0211 @ 2024-10-06 17:47:22
@QwQ_77 stack也要开long long哦,还有,最好开ios,不然可能超市
by QwQ_77 @ 2024-10-06 17:52:05
@nzy0211 谢谢打捞
已关
by QwQ_77 @ 2024-10-06 17:54:35
@nzy0211
...改了之后还是同样的测试结果咋办???
by nzy0211 @ 2024-10-06 17:56:34
@QwQ_77 那你试试unsigned long long
by nzy0211 @ 2024-10-06 17:57:13
@QwQ_77 对,2^64得都用unsigned long long
by QwQ_77 @ 2024-10-06 18:18:27
@nzy0211
行,我试试
by QwQ_77 @ 2024-10-06 18:20:51
@nzy0211
又双叒叕没过(结果一样。。。
by nzy0211 @ 2024-10-06 18:22:06
@QwQ_77 啊?你都用unsigned long long 了吗
by QwQ_77 @ 2024-10-06 18:28:20
@nzy0211 是的