#K70537. Best Student Grade
Best Student Grade
Best Student Grade
You are given information about several students and their grades. Your task is to determine the student with the highest average grade and output both the student name and their average grade. The average is computed using the formula \(\text{average} = \frac{\sum\text{grades}}{n}\), where \(n\) is the number of grades for that student.
If there are no students (i.e. the input is empty), output an empty string followed by a space and then the string None
.
In case of a tie (i.e. two or more students have the same average), choose the student that appears first in the input.
inputFormat
The first line of input contains an integer T
representing the number of students. Each of the next T
blocks consists of two lines. The first line of each block contains the student's name (a string). The second line contains one or more space-separated integers representing the student's grades.
It is guaranteed that for each student, there is at least one grade.
outputFormat
Print a single line containing the name of the student with the highest average grade and their average grade separated by a space. The average grade must be output in decimal form. If there are no students (T = 0
), print an empty string and None
separated by a space.
3
Alice
87 92 85
Bob
79 83 88
Charlie
91 87 94
Charlie 90.66666666666667