#C6326. Highest Average Score
Highest Average Score
Highest Average Score
You are given T test cases. For each test case, you are provided the number of students N followed by the details of each student. Each student detail consists of the student's name and three integer scores corresponding to three subjects.
Your task is to compute the average score (to two decimal places) for each student in a test case and determine the student(s) with the highest average score. If there are multiple students with the same highest average score, output all their names in lexicographical order. For each student that qualifies, print a line in the format:
name average_score
where average_score
is formatted with exactly two decimals.
Note: The input is read from standard input and the output should be printed to standard output.
Mathematical formulation:
For each student, let the scores be \(s_1, s_2, s_3\). Their average is given by \[ \text{avg} = \frac{s_1+s_2+s_3}{3} \] Output all student(s) whose average equals \(\max(\text{avg})\) for that test case.
inputFormat
The input begins with an integer T representing the number of test cases. For each test case:
- An integer N representing the number of students.
- Followed by N lines, each containing a student's information in the format:
name score1 score2 score3
.
All values are separated by whitespace.
outputFormat
For each test case, output the details of the student(s) with the highest average score. Each line should contain the student's name and the average score (formatted to two decimal places), separated by a space.
If there are multiple students with the same highest average score, they should be printed in alphabetical order.
## sample1
1
Alice 100 100 100
Alice 100.00
</p>