PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: utkarsh_25dec
Tester: tabr
Editorialist: iceknight1093
DIFFICULTY:
302
PREREQUISITES:
None
PROBLEM:
Four friends want to attend a concert, each ticket of which costs X rupees.
However, they will only attend if the total cost doesn’t attend 1000 rupees.
Will they attend the concert?
EXPLANATION:
Since each ticket costs X rupees and there are 4 friends, the total cost of the tickets is 4\cdot X rupees.
So, the answer is Yes
if 4\cdot X \leq 1000 and No
otherwise.
Note that this is the same thing as X \leq 250, so checking for that is a valid condition too.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
x = int(input())
print('Yes' if x <= 250 else 'No')