#C14628. Calculate Average Grades
Calculate Average Grades
Calculate Average Grades
You are given data for multiple students including their names and grades in various subjects. Your task is to calculate the average grade for each student. The average must be rounded to two decimal places.
For each student, output the student's name followed by the average grade. The input will be provided via standard input (stdin) and the output should be written to standard output (stdout).
The formula to calculate the average for a student is given by:
\(\text{average} = \frac{\sum_{i=1}^{n} g_i}{n}\)
where \(g_i\) represents each grade and \(n\) is the total number of subjects for that student.
inputFormat
The first line contains an integer \(n\) (\(n \geq 0\)), representing the number of students. Each of the following \(n\) lines contains a student's record. Each record starts with the student's name (a string without spaces) followed by one or more integers representing the grades in different subjects, separated by spaces.
outputFormat
For each student, output a line with the student's name and the average grade rounded to two decimal places, separated by a space.
## sample3
Alice 90 80 85
Bob 75 95 78
Charlie 85 89 92
Alice 85.00
Bob 82.67
Charlie 88.67
</p>