#P5740. 【深基7.例9】最厉害的学生
【深基7.例9】最厉害的学生
Problem Description
There are students taking the final exam, and you are given each student's information: name (a string of at most characters, consisting only of lowercase English letters), and scores in Chinese, Math, and English (all natural numbers not exceeding ). The student with the highest total score is the best. Please output the best student's information (name and scores for each subject). If there are multiple students with the same total score, output the one that appears earlier.
Input Format
The first line contains a positive integer , representing the number of students.
Starting from the second line, there are lines. In each line, first input a string representing the student's name, then input three natural numbers representing the scores of Chinese, Math, and English. They are separated by spaces.
Output Format
Output the best student.
3
senpai 114 51 4
lxl 114 10 23
fafa 51 42 60
senpai 114 51 4
Hint
It is guaranteed that . The name is a string of length at most , and the scores of Chinese, Math, and English are all natural numbers not exceeding .
Translated by ChatGPT 5