[Solution] To Divide or Not To Divide CodeChef Solution
Problem
Alice likes all the numbers which are divisible by . Bob does not like the numbers which are divisible by and likes all the remaining numbers. Determine the smallest number greater than or equal to which is liked by both Alice and Bob. Output if no such number exists.
Input Format
- The first line contains a single integer — the number of test cases. Then the test cases follow.
- The first and only line of each test case contains three space-separated integers , and — the parameters
👇👇👇👇👇
- mentioned in the problem statment.
Output Format
For each test case, output the smallest number which is divisible by and is not divisible by . Output if no
such number exists.
Explanation:
Test case : is the smallest number which is divisible by and is not divisible by .
Test case : is the smallest number which is divisible by and is not divisible by .
Test case : There does not exist any number which is divisible by and is not divisible by .
More Info
No comments:
Post a Comment