RAINFALL1 - Editorial

PROBLEM LINK:

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

Author: notsoloud
Testers: iceknight1093, mexomerf
Editorialist: iceknight1093

DIFFICULTY:

328

PREREQUISITES:

None

PROBLEM:

Given the amount of rain received in a day, X, decide whether the rainfall was LIGHT, MODERATE, or HEAVY.

EXPLANATION:

Simply implement the checks mentioned in the statement and print the appropriate answer.

  • If X \lt 3, the answer is LIGHT
  • If 3 \leq X \lt 7, the answer is MODERATE
  • If 7 \leq X, the answer is HEAVY

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Code (Python)
for _ in range(int(input())):
    x = int(input())
    print('Light' if x < 3 else ('Moderate' if x < 7 else 'Heavy'))