SP4761 HS09GAME - Strategy game
Description
Julia and Robert are playing a game, in which they pick up sticks from heaps. The game starts with _n_ heaps, the _i_-th heap contains _a_\[_i_\] sticks. In each turn the players choose a heap and take away 2, 3 or 5 sticks from it (removed sticks do not return to the game). Julia starts the game making the first move. The one, who cannot make a move, loses the game, and the other player wins. Can you decide who will win the game, assuming that both players follow a perfect strategy ? If Julia is the winner, point out her winning move! If there are several possibilities for such a move, then choose the one in which the largest number of sticks is taken away. If there are still several such moves, choose the one, in which sticks are taken from the heap of the smallest number.
Input Format
An integer _T_, denoting the number of testcases (_T_
Output Format
Please consult the example below for a specification of the required output format. Print a blank line after each testcase.