1 条题解

  • 0
    @ 2025-9-15 22:12:26

    板子题

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        int n;
        cin >> n;
        int op, x;
        stack<int> stk;
        for (int i = 0; i < n; ++i) {
            cin >> op;
            if (op == 1) {
                cin >> x;
                stk.push(x);
            } else {
                if (stk.empty()) {
                    cout << "all in\n";
                } else {
                    cout << stk.top() << '\n';
                    stk.pop();
                }
            }
        }
        return 0;
    }
    
    • 1

    信息

    ID
    1110
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    5
    已通过
    5
    上传者