click below for solution

Wednesday, 2 February 2022

Yet Another Constructive Problem Solution|Codesheff starter 24 for div 3


X which is at most 108.

Find three distinct non-negative integers A,B,C that do not exceed 109 and satisfy the following equation:

(AB)&(BC)&(CA)=X

Here,  denotes the bitwise OR operator and & denotes the bitwise AND operator.

It can be shown that a solution always exists for inputs satisfying the given constraints. If there are multiple solutions, you may print any of them.

Input Format

  • The first line contains an integer T, the number of test cases. The description of T test cases follows.
  • Each test case consists of a single line containing one integer, X.

Output Format

  • For each test case, print on a new line three different space-separated integers A,B,C.
  • Your output will be considered correct only if A,B,C are distinct non-negative integers not exceeding 109 that satisfy the equation given in the problem statement.
  • If there are multiple solutions, you may print any of them.

Constraints

  • 1T100
  • 1X108
  • 0A,B,C109
  • A,B,C must be pairwise distinct

Sample Input 1 

4
3
2
13
100000000

Sample Output 1 

1 2 3
2 3 4
6 9 13
23570468 129811858 80835401

Explanation

Test case 1: (12)&(23)&(31)=3&3&3=3 and hence A=1,B=2,C=3 is one valid solution when X=3. However there are several other solutions.

For example, A=1,B=6,C=3 is also valid and will also be considered correct.

Test case 2: (23)&(34)&(42)=(3&7)&6=3&6=2.

Test case 3: (69)&(913)&(136)=(15&13)&15=13&15=13.

Solution:

solution link 1

https://shareus.in/?i=yScFNErxQ

if 1st link is not work then click on another link

Solution link 2

https://shrinke.me/0joa

Solution link 3

https://afly.pro/4dPM5oi

Solution link 4

https://afly.pro/X6gV2u4

How to get link tutorial video link

https://youtu.be/0TSsPHhgwb4

No comments:

Post a Comment