Algorithm
problem Link :https://www.codechef.com/problems/CRICMATCH
Problem
There is a cricket match in Chefland. Chef's team requires runs to win in overs.
Given that over consists of balls and a player can score a maximum of runs in a ball, find whether Chef's team can win.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two space-separated integers and — the number of runs required to win the game and the remaining number of overs.
Output Format
For each test case, output on a new line, YES
, if Chef's team can win the game. Otherwise, output NO
.
You can print each character in uppercase or lowercase. For example NO
, no
, No
, and nO
are all considered identical.
Constraints
Sample 1:
4 500 20 100 2 30 1 216 6
YES NO YES YES
Explanation:
Test case : Chef's team requires runs to win. If they hit runs on every ball for overs, they will score runs.
In the over they can hit runs in the first five balls and runs in the sixth ball to get a total of runs.
Thus, Chef's team can win the game.
Test case : Since is greater than the maximum runs that can be scored overs, it is not possible for Chef's team to win the game.
Test case : Since is less than the maximum runs that can be scored in over, it is possible for Chef's team to win the game.
Test case : Since is equal to the maximum runs that can be scored in overs, it is possible for Chef's team to win the game.
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main()
{
int t,n,m;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&m);
if(n<=m*36) printf("Yes\n");
else printf("No\n">;
}
}
Copy The Code &
Try With Live Editor
Input
500 20
100 2
30 1
216 6
Output
NO
Demonstration
codeChef solution CRICMATCH - Cricket Match Codechef solution in C,C++