[Solution] Divisible by 3 CodeChef Solution | CodeChef Problem Solution 2022
Stack likes the number a lot.
He has two non-negative integers and .
In one operation, Stack can do either of the following:
- (change to )
- (change to )
Note that denotes absolute value of . For example and .
Find the minimum number of operations after which at least one integer out of
Solution Click Below:- CLICK HERE
and becomes divisible by .
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follows.
- The only line of each test case contains two integers and .
Output Format
For each test case, output in a single line the minimum number of operations after which at least one integer out of and becomes divisible by .
No comments:
Post a Comment