Give the least times you should press
  • Description

    There is a machine. It has two buttons and a screen。The red button has the function of add the number on the screen by 1. The blue button has the function of multiply the number on the screen by 2。Now, there are two number m, n. The number m is the original value, n is the final value. Give the least times which you should press to let the number m exchage to n.

  • Input

    The input will consist of a series of pairs of integers m and n (0 <= m, n <= 10000),separated by a space, one pair of integers per line.

  • Output

    For each pair of input integers m and n you should output the least times you should press to let the number m exchage to n,and with one line of output for each line in input.

  • Sample Input
    4 2
    7 11
    9 21

  • Sample Output
    0
    4
    4

Comments (1)