From A to B
题号:NC224871
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

You are given two integers, a and b. You want to transform a into b by performing a sequence of operations. You can only perform the following operations:

  • Divide a by two (but only if a is even)
  • Add one to a

What is the minimum number of operations you need to transform a into b?

输入描述:

The single line of input contains two space-separated integers a and b (1 ≤ a, b ≤ 109)

输出描述:

Output a single integer, which is the minimum number of the given operations needed to transform a into b.
示例1

输入

复制
103 27

输出

复制
4
示例2

输入

复制
3 8

输出

复制
5