NOVICE51 - A Simple Game
Akash and Aayush play the following number game. First they choose a number N (1<=N<=1000000000). Then both of them take their turn one by one. In a turn player has to subtract 1 from the number if it is odd or divide the number by 2 if it is even. Game end when the number becomes zero. Aayush has a dominating nature So he always play first. Help them in finding out who will win the game.
First line contains T, the number of test cases. Following T lines contain 1 integer each, the value of N.
For each test case print "Aayush" if Aayush wins else print "Akash".
Input: 2 468 7547 Output: Aayush Akash
http://ideone.com/Dkxfeb i want to know what is wrong in that code?
Last edit: 2012-11-20 23:31:10
will i use a loop in that code ??
mohamed nabil mohamed:
any other test cases!!!!!
notice that each of aayush and akash will play together for the same number, so that any of them will divide or subtract according to his turn
Although there is a constraint stating that 1<=N<=1000000000, there is a test case with N=0, and its correct output is "Akash" !!!!
You should add the information that the player wins who subtracts or divides last.