[Solved] Multivitamin Tablets STARTERS 73 CodeChef

The doctor prescribed Chef to take a multivitamin tablet 33 times a day for the next XX days.

Chef already has YY multivitamin tablets.

Determine if Chef has enough tablets for these XX days or not.

Input Format
  • The first line contains a single integer TT — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers XX and YY — the number of days Chef needs to take tablets and the number of tablets Chef already has.
Output Format

For each test case, output YES if Chef has enough tablets for these XX days. Otherwise, output NO.

You may print each character of YES and NO in uppercase or lowercase (for example, yesyEsYes will be considered identical).

Constraints
  • 1 ≤T≤2000
  • 1 ≤X≤100
  • 0 ≤Y≤1000

Sample 1:

Input:

4
1 10
12 0
10 29
10 30

Output:

YES
NO
NO
YES
Explanation:

Test Case 1: Chef has 1010 tablets and Chef needs 33 tablets for 11 day. Therefore Chef has enough tablets.

Test Case 2: Chef has 00 tablets and Chef needs 3636 tablets for 1212 days. Therefore Chef does not have enough tablets.

Test Case 3: Chef has 2929 tablets and Chef needs 3030 tablets for 1010 days. Therefore Chef does not have enough tablets.

Test Case 4: Chef has 3030 tablets and Chef needs 3030 tablets for 1010 days. Therefore Chef has enough tablets.

Solution

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	 
         Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if(x*3<=y){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
	}
}

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

📌 Nodejs and Android 😎
📌 Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *