#K4436. Student Grades Calculator

    ID: 27514 Type: Default 1000ms 256MiB

Student Grades Calculator

Student Grades Calculator

Given a list of students with their scores in three subjects (Math, Science, and English), calculate each student's average score and assign a grade based on the average. The average score is computed by \(\dfrac{\text{Math} + \text{Science} + \text{English}}{3}\) and rounded to two decimal places. The grade is determined as follows:

  • \(90 \leq avg \leq 100\): Grade A
  • \(80 \leq avg < 90\): Grade B
  • \(70 \leq avg < 80\): Grade C
  • \(60 \leq avg < 70\): Grade D
  • Otherwise: Grade F

Input is provided via standard input (stdin) with the first line indicating the number of students. Each subsequent line contains the student's name and their three scores, separated by spaces. The output for each student should be printed in a separate line, displaying the student's name, the average score (rounded to two decimals), and the grade, all separated by spaces.

inputFormat

The first line contains an integer \(N\) which represents the number of students. The following \(N\) lines each contain a student's information in the format:

name Math_score Science_score English_score

All values are separated by spaces.

outputFormat

For each student, output a single line containing the student's name, the average score (rounded to two decimal places), and the corresponding grade. Each value should be separated by a space.

For example:

John 87.67 B
Jane 73.67 C
## sample
1
John 85 90 88
John 87.67 B

</p>