PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: pols_agyi_pols
Tester: tabr
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
Students of Chefland receive the following grades:
'Z'
, if their attendance is less than 50\%.'F'
, if their attendance is at least 50\% but marks are less than 50\%.'A'
, otherwise.
Given the attendance and scores of a student, as X and Y respectively, predict their grade.
EXPLANATION:
It suffices to directly implement the conditions outlined in the statement.
If X \lt 50, print \text{'Z'}.
If X\geq 50 and Y\lt 50, print \text{'F'}.
Otherwise, print \text{'A'}.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
x, y = map(int, input().split())
if x < 50: print('Z')
elif y < 50: print('F')
else: print('A')