What Is My Grade?
InterviewTime limit1sMemory limit256 MB
Given 50 distinct scores sorted in descending order and Hongik's score, print the letter grade matching his rank using the fixed cutoffs.
- Level
Easy2 of 10
- Topics
- Array, Implementation, Sorting, Binary search
- Solved
- No attempts yet
Problem
Hongik, a third-year student, took Operating Systems (OS), a required course for his major, this semester. After the course ended, the professor converted everyone's midterm, final, and assignment scores to a 300-point scale and posted them on Classnet. Staring blankly at the scores, Hongik suddenly remembered that he absolutely has to receive a scholarship.
"If I don't get at least an A0 in Operating Systems, it will be hard to get the scholarship..."
On the first day of the Operating Systems class, the professor explained the grade distribution as follows.
- A+: ranks 1 to 5
- A0: ranks 6 to 15
- B+: ranks 16 to 30
- B0: ranks 31 to 35
- C+: ranks 36 to 45
- C0: ranks 46 to 48
- F: ranks 49 to 50
The professor displayed the students' final scores sorted in descending order on the Classnet real-time information page.
Grades will be announced through Classnet in 10 days, but Hongik cannot wait that long, so he wants to find out his grade with a program. Help Hongik determine his grade!
Input
The first line gives the scores of 50 students, including Hongik's score, separated by spaces. The scores are sorted in descending order, and no two scores are equal.
The second line gives Hongik's score.
Every score is an integer between 0 and 300 inclusive.
Output
Print Hongik's grade on the first line.