Alice and Bob got n confections from their folks. Each candy weighs either 1 gram or 2 grams. Presently they need to split all confections between themselves reasonably so the all out weight of Alice's confections is equivalent to the all out weight of Bob's confections. Check in the
Correct answer will be upvoted else multiple downvoted. Computer science.
Alice and Bob got n confections from their folks. Each candy weighs either 1 gram or 2 grams. Presently they need to split all confections between themselves reasonably so the all out weight of Alice's confections is equivalent to the all out weight of Bob's confections.
Check in the event that they can do that.
Note that confections are not permitted to be sliced down the middle.
Input
The primary line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow.
The primary line of each experiment contains an integer n (1≤n≤100) — the number of confections that Alice and Bob got.
The following line contains n integers a1,a2,… ,an — the loads of the confections. The heaviness of each candy is either 1 or 2.
It is ensured that the amount of n over all experiments doesn't surpass 105.
Output
For each experiment, output on a different line:
"Indeed", if everything confections can be isolated into two sets with a similar weight;
"NO" in any case.
You can output "YES" and "NO" regardless (for instance, the strings yEs, indeed, Yes and YES will be perceived as certain).

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images









