/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 12ms 628.0 KiB
#3 Accepted 16ms 532.0 KiB
#4 Accepted 16ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 1000005;

int z, u;
LL x;

bool check(int x, LL y) {
	return x * 1LL * (x + 1) == y;
}

int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

cin >> z;
while(z--) {
	cin >> x;
	x = 2 * x + 2;
	u = int(sqrt(x));
	if (check(u, x) || check(u + 1, x) || check(u - 1, x)) 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 14:44:18
Judged At
2026-01-06 14:44:18
Judged By
Score
100
Total Time
16ms
Peak Memory
628.0 KiB