33pts!!?55555呜呜呜球球了

B3614 【模板】栈

OTH_chinese_dragon @ 2024-10-25 19:41:45

#include<bits/stdc++.h>
using namespace std;
stack<unsigned long long> s;
int main() {
  int t,n;
  cin>>t;
    for (int i=0; i<t; i++) {

        cin>>n;
        for (int j=0; j<n; j++) {
            string s1;
            cin >> s1;
            // while(!s.empty()) s.pop();
            if(s1 == "push"){
                unsigned long long x;
                scanf("%lld",&x); 
                s.push(x);
            } else if(s1 == "pop"){
                if(s.empty()) cout<<"Empty\n";
                else s.pop();
            } else if (s1 == "query") {
                if (s.empty()) cout << "Anguei!\n";
                else cout << s.top() << '\n';
            } else {
                cout << s.size() << '\n';
            }

        }
    }
  return 0;
}

by 迟暮天复明 @ 2024-10-25 19:42:56

是不是 lld 改成 llu


by OTH_chinese_dragon @ 2024-10-25 19:46:10

...谢谢,我试试...好了66了


by Florrer_A @ 2024-10-25 19:46:35

@OTH_chinese_dragon __int128是个好东西


by OTH_chinese_dragon @ 2024-10-25 19:46:46

ac了谢谢


|