GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday 11 May 2022

A Bit Easy CodeChef Solution | CodeChef Problem Solution 2022

Chef was impressed by an array A of N non-negative integers. But, he was asked to solve the following problem in order to get this array.

Given a non-negative integer k, find the number of pairs (i,j) (1i<jN) such that the following condition holds true:
(Ai | Aj) + (AiAj) + (Ai & Aj) =k +Aj, where

Solution Click Below:-  CLICK HERE

You, being Chef's friend, help him get this array by solving the above problem.

Input Format

  • The first line contains an integer T, the number of test cases.
  • The first line of each test case contains two space-separated integers N and k, the number of integers in the array A and the non-negative integer k respectively.
  • The next line contains N space-separated non-negative integers A1,A2,,AN, the elements of the array A.

Output Format

For each test case, print a single line containing the number of pairs satisfying the mentioned condition.

Constraints

  • 1T200
  • 1N105
  • 0k1018
  • 0Ai1018
  • Sum of N over all test cases does not exceed 3105.

Join Now for Solution:- 

No comments:

Post a Comment