#K46697. Analyze Student Grades
Analyze Student Grades
Analyze Student Grades
You are given a list of student records. Each record consists of a student's name and a test score in the format Name Score
. Your task is to compute the average score for each student rounded to two decimal places and then print each student's name along with their average score sorted in lexicographical order (alphabetical order by name).
Use the formula for the average score: $$\text{average} = \frac{\text{sum of scores}}{\text{number of scores}}$$
inputFormat
The input is provided via standard input (stdin). The first line contains a single integer n
(0 ≤ n ≤ 105), representing the number of student records. The following n
lines each contain one student record formatted as Name Score
, where Name
is a string (without spaces) and Score
is an integer.
outputFormat
For each unique student, print a line with the student's name and their average score rounded to two decimal places, separated by a space. The output must list the students in lexicographical order by name.
## sample1
Alice 90
Alice 90.00
</p>