PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: notsoloud
Tester: yash_daga
Editorialist: iceknight1093
DIFFICULTY:
505
PREREQUISITES:
None
PROBLEM:
Chef’s team requires N runs to win a cricket match, with M overs remaining.
Each over consists of 6 balls, and a team can score upto 6 runs off of each ball.
Is there a possibility for Chef’s team to win?
EXPLANATION:
There are M overs remaining, and each one consists of 6 balls. So, the total number of balls remaining is 6M.
From each ball, at most 6 runs can be scored. So, the maximum number of runs that can be scored is 6\times 6M = 36\cdot M.
So, if N \gt 36\cdot M, there is no way for Chef’s team to win the match and the answer is No
.
If N \leq 36\cdot M, the answer is Yes
.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
n, m = map(int, input().split())
print('Yes' if 36*m >= n else 'No')