FINE - Editorial

PROBLEM LINK:

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

Author: utkarsh_25dec
Testers: iceknight1093, tabr
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Given Chef’s speed on a highway, determine the fine he has to pay.

EXPLANATION:

This is a direct application of if conditions.

The statement gives three conditions to check for the answer, so check each of them and output the appropriate answer:

  • If X \leq 70, the answer is 0.
  • If 70 \lt X \leq 100, the answer is 500.
  • If X \gt 100, the answer is 2000.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Code (Python)
for _ in range(int(input())):
    x = int(input())
    if x <= 70: print(0)
    elif x <= 100: print(500)
    else: print(2000)