[Solution] ConstructOR Codeforces Solution
You are given three integers , , and . Your task is to find any integer which satisfies all of the following conditions, or determine that no such integers exist:
- ;
- is divisible by ;
- is divisible by .
Here, denotes the bitwise OR operation.
Each test contains multiple test cases. The first line of input contains one integer () — the number of test cases.
Each test case consists of one line, containing three integers , , and ().
For each test case print one integer. If there exists an integer which satisfies all of the conditions from the statement, print . Otherwise, print .
If there are multiple solutions, you may print any of them.
In the first test case, is one of the possible solutions, since and , both of which are multiples of .
In the second test case, is one of the possible solutions, since , which is a multiple of .
In the third and fourth test cases, we can show that there are no solutions.
No comments:
Post a Comment