АВТ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

880. Doubling and increment

Time Limit: 1 seconds
Memory Limit:65535KB
Points:10
View Problem Statistics Submit Problem added Undefined

Имеется два натуральных числа a и b
Нужно получить второе число из первого, используя только две операции - умножение на 2 и прибавление единицы.
При этом общее число операций должно быть минимальным

Input

В первой строке входного файла находятся числа a и b, разделённые пробелом (1<=a<=b<231).

Output

Выведите одно число - минимальное количество операций.

Sample

InputOutput
2 5
2

View Problem Statistics Submit Author/source:
Sorted Problems / Mathematics / Theory of numbers /
41. Divisibility 880. 15. Factorials 17. Factorials 2 34. GCD & LCS
Problems from Contests / Trainings of Vologda STU / Training 07.10.10 /
880. 881. B - Prime numbers on interval 34. C - GCD & LCS 712. D - Пересечение отрезков
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.078 sec.
© Copyright VSTU, AVT, Nosov D.A.