Accepted
Code
#include<bits/stdc++.h>
using namespace std;
/*
* @author abhishek
*
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt;
cin>>tt;
while(tt--) {
long long k;
cin>>k;
long long low= 1;
long long high= 5e8;
long long ans= low;
while(low<=high) {
long long mid=(low+high)/2;
long long total= (mid)*(mid+3)/2;
if(total>=k) {
ans= mid;
high= mid-1;
} else{
low= mid+1;
}
}
long long prev= (ans-1)*(ans+2)/2;
long long rem= k-prev;
if(rem<=ans) {
cout<<"a"<<endl;
} else{
cout<<"b"<<endl;
}
}
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:47:08
- Judged At
- 2026-01-06 15:47:08
- Judged By
- Score
- 100
- Total Time
- 178ms
- Peak Memory
- 752.0 KiB