66pts求条?!
查看原帖
66pts求条?!
1356725
phi_gros楼主2024/10/28 20:32
#include<bits/stdc++.h>
using namespace std;

int main(){
    stack <unsigned long long> s;
    int t;
    cin >> t;
    while(t --){
        int n;
        cin >> n;
        for(int i = 1;i <= n;i ++){
            string a;
            unsigned long long b;
            cin >> a;
            if(a == "push"){
                cin >> b;
                s.push(b);
            }
            else if(a == "pop"){
                if(s.empty())
                cout << "Empty\n";
                else s.pop();
            }
            else if(a == "size"){
                cout << s.size() << "\n";
            }
            else{
                if(s.size())
                    cout << s.top();
                else cout << "Anguei!";
                cout << "\n";
            }
        }
    }
    return 0;
}

呜呜呜,为什么66分,调试好多遍了

2024/10/28 20:32
加载中...