Problem Description:
The first line of input contains one integer t \((1≤t≤104)\) — the number of test cases.
The first line of each test case contains an integer n \((1≤n≤100) \)— the number of candies that Alice and Bob received.
The next line contains n integers \(a_1,a_2,…,a_n\) — the weights of the candies. The weight of each candy is either 1 or 2.
Now we have to divide all candies so that the total weight of Alice's candies is equal to the total weight of Bob's candies. But, candies are not allowed to be cut in half. If it is possible to divide fairly, then output will be ‘YES’. ‘NO’ otherwise.
Ideological Analysis:
Click here for Source Code.
Tanjina Rahman, 01 Jun, 2021
Share this article on →