#C9992. Student Average and Grade Calculation

    ID: 54146 Type: Default 1000ms 256MiB

Student Average and Grade Calculation

Student Average and Grade Calculation

You are given a set of records where each record consists of a student's name followed by a list of their scores. Your task is to compute the average score for each student and determine their corresponding grade according to the following rules:

\(\textbf{Grade Allocation:}\)

  • Grade A: \(\text{if } \text{average} \geq 90\)
  • Grade B: \(\text{if } 80 \leq \text{average} < 90\)
  • Grade C: \(\text{if } 70 \leq \text{average} < 80\)
  • Grade D: \(\text{if } 60 \leq \text{average} < 70\)
  • Grade F: \(\text{if } \text{average} < 60\)

If a student's record contains no scores, consider the average as \(0.00\) and assign grade F. The average must be output with exactly two decimal places.

inputFormat

The input is provided via standard input (stdin) and consists of multiple lines. Each line represents one student's record. Each record starts with the student's name followed by zero or more integer scores separated by spaces. Process input until end-of-file (EOF).

outputFormat

For each student's record, output a line in the format: name average grade, where average is displayed with two decimal places. The outputs should be printed to standard output (stdout), one per line in the same order as the input.

## sample
John 85 90 78
Lucy 100 95 90 89 91
Mark
Alice 70 68 72 65
Henry 88 92 81 75
John 84.33 B

Lucy 93.00 A Mark 0.00 F Alice 68.75 D Henry 84.00 B

</p>