Grades
InterviewTime limit2sMemory limit512 MB
Given a list of grades, compare the midpoint of the maximum and minimum against the overall average, and report whether they differ by less than 1.
- Level
Easy2 of 10
- Topics
- Array, Math, Implementation
- Solved
- No attempts yet
Problem
Professor Snape has just finished marking the final exam papers and wants to know whether the distribution of grades is satisfactory.
He first sorted all the papers by grade, then took the highest and the lowest mark and computed their average. Call this number . Next he computed the average of all the grades. Call this number . He considers the distribution satisfactory if and only if the absolute difference between and is less than .
Write a program that helps Professor Snape.
Input
The first line contains the number of test cases .
Each test case consists of two lines. The first line holds a single integer , the number of students (). The second line holds space separated non-negative integers smaller than , the grades the students received.
Output
For each test case print Yes on its own line if the distribution is satisfactory, and No otherwise.