No.4 Weights and a Balance
Problem Statement
Dave, who plays around even during class,
apparently became curious during a science experiment about whether, using all of the weights of various kinds of mass,
there is a combination of weights that makes the balance exactly level, and he is completely absorbed in this.
(All of the weights must be used, so none may be left over.)
Tell Dave whether such a combination exists, so that he can concentrate on the class.
If such a combination exists, output \(possible\); otherwise, output \(impossible\).
Input
\(N\) \(W_1\ W_2\ W_3 \dots W_N\)
Line \(1\) contains an integer \( N\ ( 2 \leq N \leq 100) \), the number of weights.
Line \(2\) contains space-separated integers \( W_i\ ( 1 \leq W_i \leq 100) \), the mass of each weight.
\(W_i\) and \(W_j\) may have the same value.
Output
Output possible or impossible on one line.
Print a newline at the end.
Sample
Sample 1
Input
3 1 2 3
Output
possible
Placing \(1\) and \(2\) on the left side and \(3\) on the right side makes the balance level.
Sample 2
Input
5 1 2 3 4 5
Output
impossible
No combination using all of the weights makes the balance level, so tell Dave quickly, or the class will end.
Sample 3
Input
15 62 8 90 2 24 62 38 64 76 60 30 76 80 74 72
Output
impossible
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。