PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: Utkarsh Gupta
Testers: Nishank Suresh, Tejas Pandey
Editorialist: Nishank Suresh
DIFFICULTY:
374
PREREQUISITES:
None
PROBLEM:
Chef has booked a car at a rate of rupees 10 per kilometer. He has to pay for at least 300 kilometers no matter what.
If Chef travels for X kilometers, how much will he pay?
EXPLANATION:
Chef will pay for 300 kilometers if X \leq 300, and X kilometers otherwise. Each kilometer costs 10 rupees, so the answer is simply 10\cdot \max(X, 300).
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
print(10 * max(300, int(input())))