This page is still under construction.

Parts of this page are still being built. What you see may change.

Report Card Time

Time limit1sMemory limit256 MB

Summary
Convert each hobbit's numeric score to a letter grade using the given scale and print the results in input order.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Hobbit children in the Shire go to hobbit school. A course just ended, and it covered tea making, meal eating, nap taking, and gardening. Turn each hobbit's final numerical grade into a letter grade with the scale below.

  • A+: 97 to 100
  • A: 90 to 96
  • B+: 87 to 89
  • B: 80 to 86
  • C+: 77 to 79
  • C: 70 to 76
  • D+: 67 to 69
  • D: 60 to 66
  • F: 0 to 59

Input

The first line contains one integer nn, the number of hobbits in the class (1≤n≤10001 \le n \le 1000).

Each of the next nn lines contains a name aa and a grade bb separated by one space. A name consists of alphabetical characters only and is shorter than 10 characters. A grade is an integer with 0≤b≤1000 \le b \le 100.

Output

Print one line per hobbit, in the order the hobbits are given, containing the name and the letter grade separated by one space. Print no other whitespace.

Examples4

  1. Example 1

    Input
    5
    Bilbo 13
    Sam 90
    Pippin 78
    Frodo 97
    Merry 70
    
    Expected output
    Bilbo F
    Sam A
    Pippin C+
    Frodo A+
    Merry C
    
  2. Example 2

    Input
    1
    Rosie 0
    
    Expected output
    Rosie F
    
  3. Example 3

    Input
    9
    Adalgrim 100
    Bandobras 96
    Camellia 89
    Drogo 86
    Esmeralda 79
    Fredegar 76
    Gerontius 69
    Hamfast 66
    Isengrim 59
    
    Expected output
    Adalgrim A+
    Bandobras A
    Camellia B+
    Drogo B
    Esmeralda C+
    Fredegar C
    Gerontius D+
    Hamfast D
    Isengrim F
    
  4. Example 4

    Input
    9
    Adalgrim 97
    Bandobras 90
    Camellia 87
    Drogo 80
    Esmeralda 77
    Fredegar 70
    Gerontius 67
    Hamfast 60
    Isengrim 0
    
    Expected output
    Adalgrim A+
    Bandobras A
    Camellia B+
    Drogo B
    Esmeralda C+
    Fredegar C
    Gerontius D+
    Hamfast D
    Isengrim F