#K51457. Even Distribution of Coins
Even Distribution of Coins
Even Distribution of Coins
You are given several test cases. For each test case, you are provided with an integer (N) indicating the number of citizens, followed by (N) integers representing the number of golden coins each citizen initially has. Your task is to determine whether it is possible to redistribute all the coins evenly among the citizens such that each citizen ends up with the same number of coins. Formally, for each test case, let (S) be the total number of coins. Redistribution is possible if and only if (S \equiv 0 \pmod{N}).
Input: Read from standard input.
Output: Write to standard output.
inputFormat
The first line contains an integer (T) denoting the number of test cases. For each test case, the first line contains an integer (N) (the number of citizens). The second line contains (N) space-separated integers representing the coins each citizen initially has.
outputFormat
For each test case, output a single line containing either "YES" if it is possible to redistribute the coins evenly, or "NO" otherwise.## sample
1
3
3 3 3
YES
</p>