|
||||||||||
GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1491 Accepted Submission(s): 615 Problem 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), that indicates 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 piles. 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
Sample Output
Source | ||||||||||
|