adplus-dvertising

We Are Discuss About CODECHEF SOLUTION

OR Tuples Codechef Solution

OR Tuples Codechef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Problem

Chef has 3 numbers P, Q and R. Chef wants to find the number of triples (A, B, C) such that:

  • (A \mid B) = P,¬†(B \mid C) = Q¬†and¬†(C \mid A) = R¬†(Here,¬†\mid¬†denotes the¬†bitwise OR operation)
  • 0 \le A, B, C \lt 2^{20}

Can you help Chef?

Input Format

  • The first line of input will contain a single integer¬†T, denoting the number of test cases.
  • Each test case consists of a single line of input containing¬†3¬†space-separated integers denoting¬†P, Q¬†and¬†R¬†respectively.

Output Format

For each test case, output a single integer denoting the number of triplets (A, B, C) that satisfy the given conditions.

Constraints

  • 1 \leq T \leq 10^5
  • 0 \leq P, Q, R \lt 2^{20}

Sample 1:

Input

Output

3
10 12 14
0 5 5
0 0 7
4
1
0

Explanation:

Test case 1: The following 4 triplets (A, B, C) satisfy A \mid B = 10, B\mid C = 12, and C\mid A = 14: (2, 8, 12), (10, 0, 12), (10, 8, 4), and (10, 8, 12).

Test case 2: The following triplet (A, B, C) satisfies A \mid B = 0, B\mid C = 5, and C\mid A = 5: (0, 0, 5).

Test case 3: There are no triplets satisfying all the conditions.

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

SOLUTION

Here Discuss About OR Tuples Codechef Solution

SOLUTION

OR Tuples Codechef Solution

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published.