#C5841. Student Ranking
Student Ranking
Student Ranking
You are given the records of N students. Each record consists of a student's name and their scores in three subjects. Your task is to calculate the total score for each student and sort the students in descending order based on the total score. In case of a tie (i.e., students having the same total score), the student names should be compared in ascending (alphabetical) order.
The total score for a student is computed as:
( Total = score_1 + score_2 + score_3 )
After sorting, output each student's name followed by their total score, each on a new line.
inputFormat
The first line of input contains an integer N, representing the number of students.
The next N lines each contain a student's record in the following format:
Name score1 score2 score3
Where Name
is a string (without spaces) and score1
, score2
, score3
are integers.
outputFormat
Output the sorted list of students. For each student, output a line containing the student's name and their total score separated by a space.
## sample3
Alice 85 90 80
Bob 80 95 85
Charlie 90 80 85
Bob 260
Alice 255
Charlie 255
</p>