大佬们帮我瞅瞅为什么错了
查看原帖
大佬们帮我瞅瞅为什么错了
609967
kuokuo楼主2022/2/11 17:14
#include <iostream>
#include <string>
#include <stack>
#define IOS cin.tie(0) ; cout.tie(0) ; ios::sync_with_stdio(0);
using namespace std;
typedef unsigned long long  ULL;
ULL n,op;
stack<ULL>zhan;
int main()
{
    IOS;
    cin >> n; 
    while ( n-- )
    {
         cin >> op ; 
         while ( op-- )
         {
           string ope;
           cin >> ope;
           if( ope == "push" )
              {
                 ULL k;
                  cin >> k;
                  zhan.push(k);
              }
            else if( ope == "query" )
             {
                if( zhan.empty() ) cout << "Anguei!" << endl;
                else cout << zhan.top() << endl ;
             }
            else if(ope == "pop" ) 
             {
                if( zhan.empty() ) cout << "Empty" << endl ;
                else zhan.pop();
             }
            else 
             {
                cout << zhan.size() << endl;
             }
            
         }
    }
    return 0;
}
2022/2/11 17:14
加载中...