Skip to content

Instantly share code, notes, and snippets.

@PreSoichiSumi
Created April 26, 2016 08:06
Show Gist options
  • Save PreSoichiSumi/b847b87a4b9d929eb087b81c953425de to your computer and use it in GitHub Desktop.
Save PreSoichiSumi/b847b87a4b9d929eb087b81c953425de to your computer and use it in GitHub Desktop.
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