#C8683. Calculate Student Averages
Calculate Student Averages
Calculate Student Averages
Given the number of students and their scores, compute the average score for each student, rounding to the nearest integer.
The input begins with a single integer \(N\) which represents the number of students. The following \(N\) lines each contain a student's name followed by one or more scores (each score is an integer) separated by spaces.
The average for a student is calculated using the formula:
$$ \text{average} = \frac{\text{sum of scores}}{\text{number of scores}} $$
After calculating the average, it should be rounded to the nearest integer using standard rounding rules. The output consists of \(N\) lines, each containing the student's name and their average score separated by a space.
Note: All input is read from stdin
and output must be written to stdout
.
inputFormat
The first line of input contains an integer \(N\) representing the number of students. The next \(N\) lines each contain a student's name and their scores separated by spaces.
outputFormat
Output \(N\) lines, each containing a student's name and their average score (rounded to the nearest integer), separated by a space.
## sample3
Alice 56 78 90
Bob 88 67
Charlie 100 75 80 85
Alice 75
Bob 78
Charlie 85
</p>