So I am kind of stuck in a problem related to game theory!
Any help will be appreciated!
Anjali and Vaibhavi are playing a game with a pile of N coins. In this game, Anjali and Vaibhavi make their respective moves
alternately, starting with Anjali.
In a turn, a player can remove x coins from the pile if x satisfies: 1<= x <= n
x & n = 0 (bitwise and of x and n is 0.)
where 'n' is the size of the pile in the current turn.
The player who is unable to make a move loses the game.
Given the initial number of coins in a pile, determine who would win the game.
Assume that both the players play optimally throughout the game.
First-line denotes t i.e. number of test cases
Next ‘t’ lines contain n where n is the number of coins in the pile as the game commences.
For each test case, print the winning player’s name (case sensitive).
1 <= t <= 10^5
1 <= n <= 10^18
1st test case: Anjali can't make a move so Vaibhavi wins.
2nd test case: Anjali can remove 1 coin because 1&2=0 then 1 coin left so Vaibhavi can't make a move so Anjali wins.
3rd test case: Anjali can't make a move, so Vaibhavi wins.
And so on.