Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Last active July 13, 2017 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/b4c0c39f7a1fbcf92b42488c8602b3d4 to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/b4c0c39f7a1fbcf92b42488c8602b3d4 to your computer and use it in GitHub Desktop.
ABC027[C].py
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