1 条题解

  • 0
    @ 2026-3-16 20:26:30
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    int main() {
        int A, B;
        cin >> A >> B;
        int sum = A + B;
    
        const int MAXN = 5400;   // 比赛时间内最多能读到 5400 次输出
    
        int x;
        int cnt = 0;
        int last = 0;
        bool ok = false;
        int ans_num = 0, ans_time = 0;
    
        while (cin >> x) {
            cnt++;
    
            if (cnt <= MAXN) {
                last = x;
                if (!ok && x == sum) {
                    ok = true;
                    ans_num = x;
                    ans_time = 2 * cnt - 1;   // 第 cnt 次输出的时间(秒)
                }
            }
        }
    
        if (!ok) {
            ans_num = last;
            ans_time = 2 * MAXN - 1;   // 10799 秒 = 02:59:59
            cout << ans_num << " Wrong Answer ";
        } else {
            cout << ans_num << " Accepted ";
        }
    
        int h = ans_time / 3600;
        int m = (ans_time % 3600) / 60;
        int s = ans_time % 60;
    
        cout << setfill('0') << setw(2) << h << ":"
             << setw(2) << m << ":"
             << setw(2) << s << "\n";
    
        return 0;
    }
    
    • 1

    信息

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