Log inSign up
Problems / B006

Melon grade label

100 ptsCases 15Set by dongbinna
Added October 30.
2 solved2 attempted2 submissionssolvers took 1.0 tries on average

Statement

An orchard moves its harvested melons to a sorting house. The sorting house measures the sweetness of every single melon and gives it a score. A sweetness score comes out as an integer from 0 to 100. After the scoring, the staff find the band the score falls into, stick one grade label on the melon, and gather the melons with the same label into a box.

The rule for the grade labels is as in the following table.

LabelSweetness score band
Afrom 90 to 100
Bfrom 80 to 89
Cfrom 70 to 79
Dfrom 60 to 69
F59 or below

The bands do not overlap, and there is no gap between them. So whatever score comes in, exactly one label is fixed for it. Scores below 60 are not split up any further either, they are all grouped as F.

Write a program that prints the grade label to stick on a melon when the sweetness score of that one melon is given.

For example, suppose a melon has a sweetness score of 73. A worker at the sorting house comes down from the top band in order and sees whether the score falls into that band. Writing the steps along the way as a table gives the following.

Band being checkedDoes 73 fall into it
from 90 to 100No
from 80 to 89No
from 70 to 79Yes

The first band it falls into is the one from 70 to 79, so this melon's label is C.

Other melons are sorted the same way. If the sweetness score is 95, then 95 falls into the band from 90 to 100, so the label is A. If the sweetness score is 59, it falls into none of the bands and comes all the way down to the last one, so the label is F.

Putting the results for six melons that went through the sorting house into a table gives the following.

Sweetness score95897060590
LabelABCDFF

The scores that sit on the edge of a band need care. 89 is B and 90 is A, while 60 is D and 59 is F.

Input and output examples

Example 1

Input

73

Output

C

Example 2

Input

95

Output

A

Example 3

Input

59

Output

F

Example 4

Input

60

Output

D

Input

  • First the sweetness score of one melon is given as an integer on the first line. The sweetness score is an integer from 0 to 100. This one line is the only line of input, and only one melon's score is given at a time. The score is never given as a decimal, and a negative value or a value above 100 is never given either. A score of 0 can be given, and values such as the weight or the variety of the melon are not given with it.

Output

  • Print the grade label for the melon on the first line, as one uppercase character. Print one of A, B, C, D and F. Print the single character and then break the line, and do not attach a space after the character. It must not be printed in lowercase.

Requirements

  • The input is one line, and it holds one number
  • The sweetness score is an integer from 0 to 100
  • The label is one of A, B, C, D and F, and it is printed in uppercase
  • Every score below 60 is F
  • Sort the scores that sit on the edge of a band with care
  • You must write a program that reads from standard input and writes to standard output
  • Trailing spaces at the end of a line and blank lines at the end of the output are ignored when grading
  • The languages you can use are Python and JavaScript
  • The memory limit is 256MB. The browser does not measure it, it only states it
  • The time limit is set by measuring the setter's reference solution on the same runtime
  • On this problem you submit code, not a prompt. That code runs in the browser on this device, and all that goes to the server is a fingerprint of the output and the time it took. Whether it is correct is decided by the server. The run time is a number each device reports, so the code and the device details are posted next to it on the leaderboard.
  • The output has to match the expected value down to the character. A space inside a line counts the same as any other character.
  • There are 15 cases, and 4 of them show the input together with the expected output. The rest are used only when you submit and are not shown on this page.
  • You have to pass all 15 cases to solve this.
Read the requirements carefully before solving. Tampering with the grading to make a submission look like a pass can get you sanctioned if caught. The code you submit is published on the leaderboard along with the result.

Examples

4 public cases. Judging also uses hidden cases. You have to pass all 15 cases to solve this.

Input
Expected output
60
D
59
F
95
A
73
C

Solution

Your code runs on this device. Only the fingerprint of the output and the elapsed time go to the server. The server decides whether it is correct.

0 chars1 lineMemory 256MB (recorded only)Reference 2.0ms

Submitting requires you to log in. Running against the public cases works without one.

You can test with 4 public cases. Submitting runs the hidden cases too.

People who solved this problem

The time shown is the time spent solving. Input reading time is outside the solver's control, so it is excluded. And since each device reports this value itself, we record which device measured it.

1bampal227ms191 charsPythonWindows NT 10.0 / Chrome/156.0.0.0 / 8코어 / 16GB

Log in and you can see the code once you solve this problem.

2ostenhun535ms192 charsPythonWindows NT 10.0 / Chrome/154.0.0.0 / 12코어 / 32GB

Log in and you can see the code once you solve this problem.