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 1 over consists of 6 balls and a player can score a maximum of 6 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 NOnoNo, and nO are all considered identical.

Constraints

  • 1≤�≤1000
  • 1≤�≤1000
  • 1≤�≤100

Sample 1:

Input
 
Output
 
4
500 20
100 2
30 1
216 6
YES
NO
YES
YES

Explanation:

Test case 1: Chef's team requires 500 runs to win. If they hit 6 runs on every ball for 13 overs, they will score 6⋅6⋅13=468 runs.
In the 14�ℎ over they can hit 6 runs in the first five balls and 2 runs in the sixth ball to get a total of 468+6⋅5+2=500 runs.
Thus, Chef's team can win the game.

Test case 2: Since 100 is greater than the maximum runs that can be scored 2 overs, it is not possible for Chef's team to win the game.

Test case 3: Since 30 is less than the maximum runs that can be scored in 1 over, it is possible for Chef's team to win the game.

Test case 4: Since 216 is equal to the maximum runs that can be scored in 6 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

x
+
cmd
4
500 20
100 2
30 1
216 6

Output

x
+
cmd
YES
NO YES
Advertisements

Demonstration


codeChef solution CRICMATCH  - Cricket Match Codechef solution  in  C,C++

Previous
CodeChef solution AVGPROBLEM Greater Average CodeChef solution in C,C++
Next
CodeChef solution SALESEASON - Sale Season Codechef solution in C,C++