[Solution] Reduce to zero CodeChef Solution | CodeChef Problem Solution 2022
Chef has two integers and . Chef wants to perform some operations to make both and zero simultaneously. In one operation, Chef can either:
- set
- or set
- or set and
Chef is a little busy with preparing the contest. Help him find the minimum number of operations required to make both and equal to simultaneously. If it is impossible to do so after any
Solution Click Below:- CLICK HERE
number of operations, print .
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 two space separated integers and .
Output Format
For each test case, print the minimum number of operations required to make and zero simultaneously. If it is impossible to do so after any number of operations, print instead.
No comments:
Post a Comment