/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 536.0 KiB
#2 Accepted 16ms 620.0 KiB
#3 Accepted 25ms 716.0 KiB
#4 Accepted 26ms 656.0 KiB

Code

#include <bits/stdc++.h>     //   All praise is due to Allah alone, and peace and blessings be
using namespace std;         //         upon him, after whom there is no other Prophet.

int32_t main() {
    cin.tie(0)->sync_with_stdio(false);

    int32_t Case = 1;    cin >> Case;
    for (int T = 1; T <= Case; T++) {

        int64_t n; cin >> n;
        int64_t L = 0, R = 1e9, mid, ans, ans1;
        while(L <= R) {
            mid = (L + R) >> 1;
            int64_t val = mid * (mid + 1) / 2 + mid;
            if(val <= n) {
                ans = val; L = mid + 1; ans1 = mid + 1;
            }
            else R = mid - 1;
        }
        if(ans == n) {
            cout << "b\n";
        }
        else cout << "a\n";
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1223 C. Infinity Sequence
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 15:05:28
Judged At
2026-01-06 15:05:28
Judged By
Score
100
Total Time
26ms
Peak Memory
716.0 KiB