2343: Nimper!

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:7 解决:1

题目描述

  In the old times, when there was no PS or Xbox, Nimper was one of the most favorite games among the students of Sharif University. Nimper is a two player game. In this game, there are a number of piles of rocks. This game consists of two stages. In the first stage, first player removes some of the piles or none, and then the second player removes some of the remaining ones or none of them. Notice that none of the players can remove all of the piles in the first stage. In the second stage, players play turn by turn. Each player in his/her turn can choose a pile and remove any number of rocks from that pile. The player who removes the last rock is the winner of the game.
Y0u are given the number of piles and number of rocks in each one of them. You should find the minimum number of rocks that the first player has to remove in the first stage so that he/she will be the winner of the game.

输入

First line of Inputs contains the number of the tests. 

Then, for each test case, first there is an integer 1<=n<=100 that is the number of piles.

 Then there are n positive integers , each one shows the number of rocks in that pile.

输出

For each test, print the minimum number of rocks that the first player should remove in the first stage such that 

he will be the winner of the game.

样例输入 复制

1
3 1 2 3

样例输出 复制

1

来源/分类