Hide

Problem D
The Professor's Gradebook

Every year, ambitious students head to The University of Chicago eager to pursue degrees in Computer Science. While knowledge itself is the greatest reward for a quarter of diligent scholarship, students still receive a grade for each course.

Professor X teaches several rigorous introductory computer science courses, all of which have some number of assignments and a final exam. Each assignment can receive a score between 0 and 5 points. The final exam is worth a total of 50 points. All scores are given in whole numbers (i.e., students cannot receive fractions of points, only whole points).

When calculating a student’s final grade, the lowest assignment score is dropped. If there are multiple assignments with the same lowest score, only one is dropped (the one to drop can be selected arbitrarily). So, if the class has M assignments, a student’s total score, Stotal, is calculated as

Stotal=S1+S2++SM1+Sexam

where S1SM1 are the scores of the assignments with the top M1 scores. Note how the largest score a student could earn in the class is 5(M1)+50 points.

Stotal is the total score but, since Professor X’s course is notoriously difficult, students’ actual grades are based on an adjusted scale based on the top performing student in the course. The adjusted percentage, Sadjusted, is calculated by treating the student with the highest Stotal as the the total possible points available in the course. So, if MAX(Stotal) is the highest score for a given class, then Sadjusted for a student is obtained as follows:

Sadjusted=StotalMAX(Stotal)×100

Yes, at least one student each quarter will receive a 100% in the course!

Professor X then takes Sadjusted and converts it to an integer, which we will refer to as Sgrade, because this is the value used to determine the student’s final grade. Professor X is tough but also generous: Sgrade is obtained by rounding Sadjusted up to the nearest integer. So, if Sadjusted is 89.0, Sgrade will be 89. However, if Sadjusted is 89.00001, then it will be rounded up and Sgrade will be 90.

Once Professor X has Sgrade, the student letter grade is assigned based on the following scale:

  • A: 90Sgrade100

  • B: 80Sgrade<90

  • C: 70Sgrade<80

  • D: 60Sgrade<70

  • F: Sgrade<60

In this problem, you will compute Stotal, Sgrade, and the letter grade for each student.

Input

The input contains a list of students with their scores in the assignments and the exam. The input begins with a line containing two integers separated by a single space: the number of students N (1N100), and the number of assignments M (2M20).

This line is followed by N lines, each representing a single student. Each such line contains a two-character string (the student’s initials) followed by M+1 integers, representing the scores on the M assignments and on the exam. Every value is separated by a single space. The student’s initials are not guaranteed to be unique (i.e., there can be more than one student with the same initials).

Output

The output is composed of N lines, one per student. Each line contains the student’s initials followed by that student’s Stotal, Sgrade, and their letter grade. Each value is separated by a single space. The students must appear in the same order as they appear in the input.

Sample Input 1 Sample Output 1
3 11
AB 1 2 3 4 3 2 3 3 2 1 2 35
CD 0 0 1 3 2 2 0 1 1 2 3 25
EF 5 4 4 3 4 5 1 3 3 5 4 40
AB 60 75 C
CD 40 50 F
EF 80 100 A
Sample Input 2 Sample Output 2
3 6
MB 1 2 3 4 3 5 43
BD 0 0 1 2 3 1 25
CT 5 5 5 5 5 5 40
MB 60 93 A
BD 32 50 F
CT 65 100 A
Sample Input 3 Sample Output 3
5 8
BJ 5 3 2 2 5 0 1 2 32
EA 0 5 2 2 3 5 5 0 40
ZN 2 2 3 3 5 4 5 3 48
IZ 1 4 4 3 1 4 3 2 37
LD 0 5 2 3 5 2 4 5 42
BJ 52 72 C
EA 62 85 B
ZN 73 100 A
IZ 58 80 B
LD 68 94 A
Hide

Please log in to submit a solution to this problem

Log in