Problem solution codechef
Be afraid, be very afraid.
On Halloween, Chef is in a somber mood.
Chef has an odd integer � that he has to decode.
To do so, Chef would like to find a pair of integers � and � (0≤�,�<230) such that:
Help Chef find any such pair!
It can be proved that a valid pair always exists.
Here, ∣ represents the bitwise OR operation, and ⊕ represents the bitwise XOR operation.
Input Format
- The first line of input will contain a single integer �, denoting the number of test cases.
- The first and only line of each test case contains a single odd integer �.
Output Format
For each test case, output on a new line two space-separated integers � and � such that 0≤�,�<230, and
If multiple solutions exist, you may print any of them.
It can be proved that a solution always exists under the given constraints.
Constraints
- 1≤�≤1000
- 1≤�≤109
- � is odd.
Sample 1:
4 1 49 21 35
1 0 3 4 7 4 7 2
Explanation:
Test case 1: We have �=1. Choose �=1 and �=0, which gives us (�∣�)=1 and (�⊕�)=1.
1⋅1=1, so this is a valid solution.
Test case 2: We have �=49. Choose �=3 and �=4, which gives us (�∣�)=7 and (�⊕�)=7.
7⋅7=49, so this is a valid solution.
Test case 3: Here, �=21. Choose �=7 and �=4, which gives us (�∣�)=7 and (�⊕�)=3.
7⋅3=21, so this is a valid solution.
Test case 4: Here, �=35. Choose �=7 and �=2, which gives us (�∣�)=7 and (�⊕�)=5.
7⋅5=35, so this is a valid solution.