SEATNUMBER - Editorial

PROBLEM LINK:

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

Tester and Editorialist: iceknight1093

DIFFICULTY:

613

PREREQUISITES:

None

PROBLEM:

Given the seat numbering plan of a bus and specific seat in it, output whether the set is in the upper or lower deck, and a single or double seat.

EXPLANATION:

Looking at the seat plan, we can see that for seat number N:

  • If 1 \leq N \leq 10, the seat is Lower Double
  • If 11 \leq N \leq 15, the set is Lower Single
  • If 16 \leq N \leq 25, the seat is Upper Double
  • If 26 \leq N \leq 30, the seat is Upper Single

Check which one of the four conditions N satisfies, and output the appropriate type.

TIME COMPLEXITY

\mathcal{O}(1) per test case.

CODE:

Editorialist's code (Python)
for test in range(int(input())):
    n = int(input())
    if n <= 10: print('Lower Double')
    elif n <= 15: print('Lower Single')
    elif n <= 25: print('Upper Double')
    else: print('Upper Single')