/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 376.0 KiB
#2 Accepted 21ms 608.0 KiB
#3 Accepted 30ms 592.0 KiB
#4 Accepted 52ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define debug(a) cerr << #a << " = " << (a) << nl;
#define ll long long
#define int long long
#define nl '\n'

void jAVA()
{
    int n; cin >> n;
    int l = 1;
    int r = 1e9;
    int ans = 0;
    while(l<=r) {
        int m = (l+r)/2; m++;
        if((m*m+m)/2-1 <= n) {
            ans = (m*m+m)/2-1;
            l = m;
        }
        else r = m-2;
    }
    if(ans == n) cout << "b\n";
    else cout << "a\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    int t = 1, cs = 0;
    cin >> t;
    while (t--){
        // cout << "Case " << ++cs << ": ";
        jAVA();
    }
    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 14:47:11
Judged At
2026-01-06 14:47:12
Judged By
Score
100
Total Time
52ms
Peak Memory
608.0 KiB