Skip to content

Commit 926de3f

Browse files
committed
atcoder/abc027C
1 parent e4cb0a3 commit 926de3f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

atcoder/abc027/C/main.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int bits(ll N) {
8+
int bc = 0;
9+
while (N > 0) {
10+
N >>= 1;
11+
++bc;
12+
}
13+
return bc;
14+
}
15+
16+
bool solve(ll N) {
17+
int const M = bits(N);
18+
ll v = 1;
19+
int i = 0;
20+
for (; v <= N; ++i) {
21+
v <<= 1;
22+
if (i % 2 == 0 && M % 2 == 1) {
23+
v += 1;
24+
}
25+
if (i % 2 == 1 && M % 2 == 0) {
26+
v += 1;
27+
}
28+
}
29+
return i % 2 == 0;
30+
}
31+
32+
int main() {
33+
ios_base::sync_with_stdio(false);
34+
cin.tie(0); cout.tie(0);
35+
36+
ll N;
37+
cin >> N;
38+
auto ans = solve(N) ? "Takahashi" : "Aoki";
39+
cout << ans << endl;
40+
41+
return 0;
42+
}

0 commit comments

Comments
 (0)