# 50139. GPA

## I'm a slow walker, but I never walk backwards.

Write a program to determine a list of students who will receive the NTU Book Coupon Award. You will be given the course information of all students, calculate their GPAs, and find out who will receive the awards. First, you need to detremine the number of awards according to the total number of students. If the number of students is no more than 20, there will be only one award. Otherwise if the number of students is no more than 40, then there will be two awrads, and so on. Please refer to the following figure.

sample

Next you need to calculate GPA of every student. The information include the number of courses a studnt takes, the number of credits of every course, and the grade of every course. The GPA is simply a weighted average of the scores from the courses a student takes. Please refer to the following figure for the mapping from the grades to GPA.

sample

The students with the highest GPAs receive the awards. However, there are other additional requirements. A student needs to take at least $15$ credits of courses and receives at least $3.38$ GPA to qualify for the award. That is, if there are four awards, but only two among the four students with the highest GPAs satisfy the rules, then only these two students will receive the awards. Please refer to the following figure for an illustration.

sample

All data you need are stored in structures, and they are defined in GPA_calculation.h.

struct Class{    int academic_credit;      char score[3];};struct Student{    char name[20];    int N_class; // total number of classes the student takes.    int N_credit; // total number of academic credits.    double GPA;    struct Class all_class[10];}; void GPA_calculation(struct Student all_student[], int N);


We will use our main function to read the input data so you only have to implement the following function.

void GPA_calculation(struct Student all_student[], int N);


Here is main function.

#include <stdio.h>#include "GPA_calculation.h" int main(int argc, char const *argv[]){    struct Student all_student[10000];    int N, i, j;     scanf("%d", &N);    for(i = 0; i < N; i++){        scanf("%s%d", all_student[i].name, &all_student[i].N_class);        for(j = 0; j < all_student[i].N_class; j++){            scanf("%d%s", &all_student[i].all_class[j].academic_credit, all_student[i].all_class[j].score);        }        all_student[i].N_credit = 0;        all_student[i].GPA = 0.0;    }     GPA_calculation(all_student, N);     return 0;}


## Input Format

The first line has one integer $N$, which is total number of students. The Second line has one string for the name of the studnet, and an integer $K$ for the number of courses a student takes. Each of the next $K$ lines denote a course, and has one integer $P$ for the number of credits, and a string $S$ for the grade. The rest of the input has information for the all the remainming $N - 1$ students.

## Output Format

Each line of the ouptut has the information of a studnet receiving the award in decreasing GPA order. Every line has student’s ranking (as an integer starting form 1), the name (as string), and the GPA (as a double, using %f to output). Note that some ranking may be missing due to that some students are not qualified.

• 10 points: There is only one student and he/she is qualified for the award.
• 20 points: There are exactly 20 students, and all of them are qualified for the award.
• 70 points: There are an arbitrary number of stduents, and some may not be qualified for the award.

## Sample Input1

1Alice 35 A+5 A5 A-


## Sample Output1

1 Alice 4.000000


## Sample Input2

In “Download Testdata”.(Too large.)


## Sample Output2

1 Reponzo2 4.052941


## Sample Input3

In “Download Testdata”.(Too large.)


## Sample Output3

1 Reponzo130 4.3000003 Elsa64 3.431250