CF1472B Fair Division

题目描述

Alice 和 Bob 从他们的父母那里收到 $n$ 颗糖果。每一颗糖果重达 $1$ 或 $2$ 克。现在,他们想要公平地将糖果分为两组,使得两组糖果的重量只和相等。 请你判断是否可以实现。注意,糖果都不能被切成两半。

输入格式

输入第一行一个整数 $t$($1\le t\le 10^4$),表示测试数据的组数。 接下来,每组数据第一行一个整数 $n$($1\le n\le 100$),表示两人收到的糖果数量。 接下来一行 $n$ 个整数 $a_1,a_2,\dots,a_n$,表示每颗糖果的重量。糖果的重量为 $1$ 或 $2$。

输出格式

输出共 $t$ 行。对于每组测试数据,输出一行一个字符串、如果可以分成重量相等的两组,则输出 `YES`,否则输出 `NO`。 translate by @[1289H2051N343O375S8](https://www.luogu.com.cn/user/45475)。

说明/提示

In the first test case, Alice and Bob can each take one candy, then both will have a total weight of $ 1 $ . In the second test case, any division will be unfair. In the third test case, both Alice and Bob can take two candies, one of weight $ 1 $ and one of weight $ 2 $ . In the fourth test case, it is impossible to divide three identical candies between two people. In the fifth test case, any division will also be unfair.