Skip to main content

Posts

Showing posts with the label CodeChef

Lucky Number | SnackDown 2021 - Online Qualifiers

Given three digits  A A ,  B B , and  C C  of the lottery ticket, tell whether Chef wins something or not? Input Format First line will contain  T T , the number of test cases. Then the test cases follow. Each test case contains a single line of input, three space separated integers  A , B , C A , B , C . 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 1 ≤ T ≤ 1000 1 ≤ T ≤ 1000 0 ≤ A , B , C ≤ 9 0 ≤ A , B , C ≤ 9 Sample Input 1  3 0 0 0 7 8 9 2 7 7 Sample Output 1  NO YES YES Explanation Test Case  1 1 :  Since no digit is equal to  7 7 , Chef fails to win any amount in the lottery. Test Case  2 2 :  Since the first digit is equal t...

Black cells in a chessboard Problem Code: BLACKCEL

Given n (n is even), determine the number of black cells in an n×n chessboard Input Format The only line of the input contains a single integer  n n . Output Format Output the number of black cells in an  n × n n × n  chessboard. Constraints 2 ≤ n ≤ 100 2 ≤ n ≤ 100 n n  is even Sample Input 1  8 Sample Output 1  32 Explanation There are  32 32  black cells and  32 32  white cells in an  8 × 8 8 × 8  chessboard. So the answer is  32 32 . import java . util .*; public class BlackCell {             public static void main ( String [] args ) throws Exception {             Scanner sc = new Scanner ( System . in );                         int n = sc . nextInt ();             System . out . println ( n * n / 2 );             ...

Test Match Series Problem Code: TESTSERIES | SnackDown 2021 - Online Qualifiers

A  5  match test series between India and England has just concluded. Every match could have ended either as a win for India, a win for England, or a draw. You know the result of all the matches. Determine who won the series or if it ended in a draw. A team is said to have won the series if it wins strictly more test matches than the other team. Input Format First-line will contain  T T , the number of test cases. Then the test cases follow. Each test case contains a single line of input, five space-separated integers  R 1 , R 2 , R 3 , R 4 , R 5 R 1 , R 2 , R 3 , R 4 , R 5  denoting the results of all the five matches.  R i = 0 R i = 0  denotes that the test match ends in a draw.  R i = 1 R i = 1  denotes that the test match is won by India.  R i = 2 R i = 2  denotes that the test match is won by England. Output Format For each test output  "DRAW"  if the series ends in a draw,  "INDIA"  if the series is won by ...