#K44107. Report Card Generator

    ID: 27458 Type: Default 1000ms 256MiB

Report Card Generator

Report Card Generator

You are given data for T students. For each student, you are given the student's name and a series of scores. Your task is to compute the average score (using integer division) for each student and then determine their letter grade based on the following criteria:

\( \text{grade} = \begin{cases} A & \text{if } \text{average} \ge 90, \\ B & \text{if } 80 \le \text{average} < 90, \\ C & \text{if } 70 \le \text{average} < 80, \\ D & \text{if } 60 \le \text{average} < 70, \\ F & \text{if } \text{average} < 60. \end{cases} \)

Then, for each student, output the student's name on the first line and on the second line output the average score followed by the letter grade, separated by a single space.

The input is given via standard input and the output must be printed to standard output.

inputFormat

The input begins with an integer T representing the number of students. Each student is described by two lines:

  • The first line contains the student's name (a string without spaces).
  • The second line contains a series of space-separated integers representing the student's scores.

For example:

2
Alice
85 92 78
Bob
70 65 80 90

outputFormat

For each student, output two lines:

  • The first line is the student's name.
  • The second line contains the average score (computed using integer division) and the corresponding letter grade, separated by a space.

For example, the output for the sample input is:

Alice
85 B
Bob
76 C
## sample
2
Alice
85 92 78
Bob
70 65 80 90
Alice

85 B Bob 76 C

</p>