Time Exceeded
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
ll k, cur = 0, a = 1;
cin >> k;
while(1){
cur += a + 1;
if(k < cur){
cout << "a\n";
return;
}else if(k == cur){
cout << "b\n";
return;
}
a++;
}
}
int main(){
ios_base::sync_with_stdio(0), cin.tie(0);
int t = 1;
cin >> t;
while(t--){
solve();
}
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:20:17
- Judged At
- 2026-01-06 15:20:17
- Judged By
- Score
- 20
- Total Time
- ≥1097ms
- Peak Memory
- ≥608.0 KiB