1423  Sort the list
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 461
Solved: 143
 Description
The midterm examination is over, All students celebrate their freedom including xiaoY, but unfortunately, xiaoY is the monitor of class7, So he have to help Mr. HH calculate scores and sort the grades list.
Mr. HH gives xiaoY a list of grades, and asks xiaoY to arrange it into a descending order. (Sorted by their total score, if there is a tie, then sorted by their names lexicographically ascending ordered)
 Input
First an Integer T (0<T<100) indicates the number of test case, then followed by a number N (0<N<70) indicates the number of student.
Then each line describes one student’s grades formatted as:
[Name] [T] [Subject 1] [Grade 1] [Subject 2] [Grade 2]….[Subject T] [Grade T] (T indicates
How many courses student chooses:
(Attention! student’s subject maybe not different, because we have selective course.)
 Output
First a line show the case information formatted as: “Case #[CaseNumber]:” , then followed by a sorted list just as input:
[Name] [T] [Subject 1] [Grade 1] [Subject 2] [Grade 2]….[Subject T] [Grade T] [Total grade]
(Notice! there is one thing new, Total grade!)
 sample input

2 3 xiaoY 3 Math 85 Chinese 80 C 90 Newton 3 Math 80 Physics 80 C 80 Frank 3 Math 70 Chinese 80 Basic 90 2 John 3 Math 50 Physics 80 C 80 Tim 3 Math 60 Chinese 80 Basic 90
 sample output

Case #1: xiaoY 3 Math 85 Chinese 80 C 90 255 Frank 3 Math 70 Chinese 80 Basic 90 240 Newton 3 Math 80 Physics 80 C 80 240 Case #2: Tim 3 Math 60 Chinese 80 Basic 90 230 John 3 Math 50 Physics 80 C 80 210
 hint
 source