We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4cb0a3 commit 926de3fCopy full SHA for 926de3f
atcoder/abc027/C/main.cpp
@@ -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
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