F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Boys and girls

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1295    Accepted Submission(s): 382


Problem Description
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!".
 

Input
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).
 

Output
If the information correspond to a valid situation,output the number of people,otherwise output"Impossible!".
 

Sample Input
1 3 2 1 1
 

Sample Output
2
 

Author
Teddy
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 22:57:01, Gzip enabled