Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Prepared by Ibrahim Mesecan.
The student with the highest average
Shqip
Your math professor stores exam results of the students in a text file, one student information per line.
He wants to see the student with the highest average. Because not all the students are able to take
all the exams, every student has different number of exams.
To help you process the marks easily, the professor has placed -999 at the end of every line.
Input specification
The first line contains a number (n) that shows the number of students in the class where 0 < n ≤ 100.
The following n lines contain n students' names and marks.
Each line starts with the name of the student. Student names are not longer than 15
characters and contain only English letters. The student names are followed by m integer marks of that student
where 0 < m ≤ 100 and every mark is an integer number between 1 and 100. The last
number in every line is -999 (minus 999) which shows the end of that student's marks.
Note: -999 is not calculated in the average.
Output specification
You will show the name and average of the student with the highest average. The average is double precision. But
the program will take into account only the first three digits. The program uses
if (abs(yourCalculatedAverage-expectedAverage)>0.001) return ERROR;
to decide if given result is correct or not.
Sample Input:
5
Alban 50 55 60 65 -999
Gerald 67 62 43 -999
Ardit 71 82 90 91 85 -999
Elton 95 95 100 -999
Xhuljana 72 83 91 100 52 98 66 55 -999
Sample Output:
Elton 96.666
Для отправки решений необходимо выполнить вход.
|