Category
Similar Problems
0736. Boxes
Time limit : 1000 ms
Memory limit : 64 mb
There are two boxes. There are a balls in the first box, and b balls in the second box (0 < a + b <2147483648). It is possible to move balls from one box to another. From one box into another one should move as many balls as the other box already contains. You have to determine, whether it is possible to move all balls into one box.
Input
Contains two integers a and b, delimited by space.
Output
Print the number of moves which are required to move all balls into one box, or -1 if it is impossible.
Samples
№ |
Input |
Output |
1 |
2 6 |
2 |
2 |
8 12 |
-1 |
3 |
7 9 |
4 |
Text from: acm.sgu.ru