Given three digits , , and of the lottery ticket, tell whether Chef wins something or not?
Input Format
- First line will contain , the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, three space separated integers .
Output Format
For each testcase, output in a single line answer "YES"
if Chef wins a positive amount with the lottery and "NO"
if not.
You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).
Constraints
Sample Input 1
3
0 0 0
7 8 9
2 7 7
Sample Output 1
NO
YES
YES
Explanation
Test Case : Since no digit is equal to , Chef fails to win any amount in the lottery.
Test Case : Since the first digit is equal to , Chef will win some amount in the lottery.
Test Case : Since the second and third digit is equal to , Chef will win some amount in the lottery.
Solution:
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 a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
if(a == 7 || b == 7 || c==7)
System.out.println("YES");
else
System.out.println("NO");
}
sc.close();
}
}
Comments
Post a Comment