1550 - Game
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 2
Solved: 1
- Description
- Mr.Frost is a child who is too simple, sometimes naive, always plays some simple but interesting games with his friends. Today,he invents a new game again:
At the beginning of the game they pick N (1<=N<=100) piles of stones, Mr.Frost and his friend move the stones in turn. At each step of the game, the player chooses a pile, removes at least one stone from the pile, the first player can’t make a move, and loses. So smart is the friends of Mr.Frost that Mr.Frost always loses. Having been a loser for too many times, he wants to play a trick. His plan is to remove some piles, and then he can find a way to make sure that he would be the winner after his friends remove stones first.
Now, he wants to know how many ways to remove piles which are able to achieve his purpose. If it’s impossible to find any way, please print “-1”. - Input
- The first line contains a single integer t (1<=t<=20),thatindicates the number of test cases. Then follow the t cases. Each test case begins with a line contains an integer N (1 <= N <= 100), representing the number of the plies. The next n lines, each of which has a positive integer Ai(1<=Ai<=2^31 - 1) represent the number of stones in this pile.
- Output
- For each case, output a line contains the number of the way mod 1000007, If it’s impossible to find any way, please print “-1”.
- sample input
-
2 2 1 1 3 1 2 3
- sample output
-
2 1
- hint
- source
- Ni Sheng | 2011 Multi-University Training Contest 8 - Host by HUST