Bitwise Equation CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

Bitwise Equation CodeChef Solution

Bitwise Equation CodeChef Solution

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

Problem

Given an integer , find four positive distinct integers  and  such that:

  • 1≤�,�,�,�≤1018
  • ((�&�)∣�)⊕�=�

Here &, and  represent bitwise AND, OR and XOR, respectively.

If there are multiple answers, print any of them. If no answer exists, print −1.

Input Format

  • The first line of input will contain a single integer , denoting the number of test cases.
  • Each test case consists of one line of input, containing a single integer .

Output Format

For each test case, output −1 if there is no way to find four distinct integers to satisfy the equation.

Otherwise, print on a new line any four space-separated integers  and  that satisfy the conditions.

Constraints

  • 1≤�≤104
  • 0≤�<232

Sample 1:

Input

Output

3
1
2
3221225472
1 4 3 2
2 4 3 1
920426639 955944413 754668683 4244364431

Explanation:

Test case 1: We have �=1�=4�=3�=2 and ((�&�)∣�)⊕�=(0∣3)⊕2=3⊕2=1.

Test case 2: We have �=2�=4�=3�=1 and ((�&�)∣�)⊕�=(0∣3)⊕1=3⊕1=2.

Test case 3: Note that the value of  might exceed the limit of signed a 32-bit integer, use unsigned 32-bit integers or 64-bit integers instead.

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

 

SOLUTION

Here Discuss About Solve Bitwise Equation CodeChef Solution

SOLUTION

Bitwise Equation 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. Required fields are marked *