DOREWARD - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: notsoloud
Tester: satyam_343
Editorialist: iceknight1093

DIFFICULTY:

395

PREREQUISITES:

None

PROBLEM:

Given the number of times a person has donated blood, X, decide whether they receive a Bronze, Silver, or Gold medal.

EXPLANATION:

It’s enough to directly implement the conditions provided in the statement, using if conditions.
That is,

  • If X \leq 3, print Bronze.
  • If 4 \leq X \leq 6, print Silver.
  • If 7 \leq X, print Gold.

TIME COMPLEXITY

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
testcases = int(input())
for t in range(testcases):
    x = int(input())
    if x <= 3: print('Bronze')
    elif x <= 6: print('Silver')
    else: print('Gold')