Grading
Time limit1sMemory limit1024 MB
Given counts of satisfied A, C, and E criteria, print the grade from E up to A using the half-threshold rules for D and B.
- Level
Easy2 of 10
- Topics
- Implementation, Math, Greedy
- Solved
- No attempts yet
Problem
Pelle is a programming teacher at Pelles Optimeringsskola (PO-skolan). He is now grading his students in the course Optimering 1.
Grading works as follows. There are A criteria, C criteria, and E criteria in use. To receive the grade E, a student must satisfy all E criteria. To receive the grade C, a student must satisfy all C and E criteria. To receive the grade A, a student must satisfy all A, C, and E criteria.
There are also two special grades. If a student satisfies all E criteria and at least half of the C criteria, the student receives a D. If a student satisfies all E and C criteria and at least half of the A criteria, the student receives a B.
Pelle finds grading very tedious and needs your help. Write a program that takes the number of A, C, and E criteria a student has satisfied and prints the grade the student should receive. You may assume the student always received at least E in the course.
Input
The first line contains three integers , , and , the number of A, C, and E criteria that exist. The second line contains three integers , , and , the number of A, C, and E criteria the student has satisfied.
Output
The program should print a single letter: A, B, C, D, or E.
Hint
In sample case 1, the student satisfies every criterion except one A criterion. The student therefore receives a B.
In sample case 2, the student satisfies all E criteria but not half of the C criteria. The student therefore receives an E.