Created
April 26, 2016 08:06
-
-
Save PreSoichiSumi/b847b87a4b9d929eb087b81c953425de to your computer and use it in GitHub Desktop.
This file contains hidden or 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 java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
long N=sc.nextLong(); | |
long depth=0; | |
long tmp=N; | |
while(tmp>1){ | |
tmp/=2; | |
depth++; | |
} | |
boolean Tleft=true; | |
boolean turn=true;//tでtrue | |
if(depth%2==0){ | |
Tleft=false; | |
} | |
//boolean takahashi=true;//どっちが負けたかフラグ | |
//simulate | |
long num=1; | |
while(num<=N){ | |
if(turn){//T | |
if(Tleft){ | |
num=num*2; | |
}else { | |
num=num*2+1; | |
} | |
}else{ | |
if(Tleft){ | |
num=num*2+1; | |
}else{ | |
num=num*2; | |
} | |
} | |
turn=!turn; | |
} | |
if(turn){ | |
System.out.println("Takahashi"); | |
}else{ | |
System.out.println("Aoki"); | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment