ORIGINAL CODING QUESTION
Scores above the batch average
A mock-test batch produced n integer scores. Count how many scores are strictly greater than the exact average of all n scores. A score equal to the average does not count, and the average may be a fraction.
Original exercise · easy. Editorial role relevance does not imply a company has asked this question.
Input and output
First integer n, then n integers. Print one integer.
Constraints
1 ≤ n ≤ 200; -1000 ≤ score ≤ 1000.
Example 1
Input
4 10 20 30 40
Output
2
The average is 25; the scores 30 and 40 are above it.
Example 2
Input
3 7 7 7
Output
0
Every score equals the average, so none is strictly above it.
Explain your approach
Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?
Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.
Hint 1
First compute the total of all scores.
Hint 2
Comparing with a fractional average can be done without division.
Hint 3
A score x is above the average exactly when x * n > total, which keeps everything in integers.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →