Boys and girls
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 32768/32768 K (Java/Others)
In a big party,there are N people some are boys and the others are girls.Now we will ask them how many girls can they see around the party(expect themselves).And the number will be A1,A2,A3...AN.Then can you tell the total number of girls using the information above?If the information is wrong and doesn't correspond to a unique valid situation,just output"Impossible!".
The first line will contain a integer T,then T cases.
At first,there is a integer N,means N people(1<=N<10000),then N integers A1,A2...AN,indicating how many girls he/she sees(except himself/hersels).
If the information correspond to a valid situation,output the number of people,otherwise output"Impossible!".
ZJFC 2009-3 Programming Contest