A :: Grades
Time Limit: 2 Seconds Memory Limit: 32768 KB
Professor Snape has just marked the final exam papers and wants to know if the distribution of grades is satisfactory or not. He first sorted all papers by their grades and then took the best and worst marks and took their average. Let’s call his number A. Then he took the average of all the grades. Let this number be called B. If and only if the absolute difference between A and B is less than 1, he considers the distribution to be satisfactory.
Write a program to help professor Snape.
The first line contains the number of test cases T.
Each test case consists of two lines, the first line is a single integer, n ≤ 50000, the number of students and the second line has n space separated non-negative integers smaller than 101, the grades students received.
For each test case print “Yes” (without quotations) if the distribution is satisfactory and “No” (without quotations) otherwise.
2 3 1 2 3 3 1 10 100
Source: 14th Iran Nationwide Internet Contest