Professor Na's Bad Handwriting
InterviewTime limit1sMemory limit512 MB
Replace every 0 and 6 digit with 9 in each score, cap at 100, then print the integer nearest the average, breaking ties upward.
- Level
Easy3 of 10
- Topics
- Implementation, Math, Array
- Solved
- No attempts yet
Problem
Professor Na is famous at Hanyang University for bad handwriting. The reason Professor Na became notorious for bad handwriting comes down to digits. Having long emphasized simplicity, the professor writes '0', '6', and '9' so simply that they cannot be told apart. (Write "simple" and read it as "sloppy.")
After the midterm exam, the teaching assistant of Professor Na's class, TA Na, found himself in a difficult situation. The professor handed over the exams he had graded and told him to report the students' average score right away. The problem is that the scores the professor wrote cannot be read properly because of his bad handwriting. TA Na, who had long admired the professor's simple nature, decided to unify the indistinguishable digits '0', '6', and '9' into '9' for the students' happiness. (If a score exceeds 100, it is treated as 100.)
Now you, another teaching assistant of Professor Na's class, must help TA Na compute the students' average.
Input
The first line gives the number of students N. (1 ≤ N ≤ 1,000)
The next N lines give the integer scores Qi that Professor Na wrote down, in order. (1 ≤ Qi ≤ 100)
Output
On the first line, print the integer closest to the average score that TA Na computed. If there are several such integers, print the largest of them.