[Solved] Chef is playing Ludo STARTERS 73 CodeChef

Chef is playing Ludo. According to the rules of Ludo, a player can enter a new token into the play only when he rolls a 66 on the die.

In the current turn, Chef rolled the number XX on the die. Determine if Chef can enter a new token into the play in the current turn 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 one integer XX — the number rolled by the Chef on the die.
Output Format

For each test case, output YES if the Chef can enter a new token in the game. 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≤6
  • 1 ≤X≤6

Sample 1:

Input:

3
1
6
3

Output:

NO
YES
NO
Explanation:

Test Case 1: Since Chef did not roll a 66, he can not enter a new token in the play.

Test Case 2: Since Chef rolled a 66, he can enter a new token in the play.

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
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            int x = sc.nextInt();
            if(x==6){
                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 *