Last active
July 13, 2017 04:21
-
-
Save IKKO-Ohta/b4c0c39f7a1fbcf92b42488c8602b3d4 to your computer and use it in GitHub Desktop.
ABC027[C].py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
N = int(input()) | |
n = N ; depth = 0 | |
while(n>0): | |
n = n // 2 | |
depth +=1 | |
def solve(): | |
t = 0 | |
x = 1 | |
if depth % 2 == 1: | |
while(1): | |
if (2*x + 1 > N and 2*x >N): | |
return 1 if t % 2 == 1 else -1 | |
t += 1 | |
if t % 2 == 1: x = 2*x + 1 | |
else: x = 2*x | |
else: | |
while(1): | |
if (2*x + 1 > N and 2*x >N): | |
return 1 if t % 2 == 1 else -1 | |
t +=1 | |
if t % 2 == 1: x = 2*x | |
else: x = 2*x + 1 | |
if __name__ == '__main__': | |
ans = solve() | |
#print("depth",depth) | |
if ans == 1: print("Takahashi") | |
else:print("Aoki") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment