시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 32985 9113 5712 24.899%

문제

수빈이는 동생과 숨바꼭질을 하고 있다. 수빈이는 현재 점 N(0 ≤ N ≤ 100,000)에 있고, 동생은 점 K(0 ≤ K ≤ 100,000)에 있다. 수빈이는 걷거나 순간이동을 할 수 있다. 만약, 수빈이의 위치가 X일 때 걷는다면 1초 후에 X-1 또는 X+1로 이동하게 된다. 순간이동을 하는 경우에는 1초 후에 2*X의 위치로 이동하게 된다.

수빈이와 동생의 위치가 주어졌을 때, 수빈이가 동생을 찾을 수 있는 가장 빠른 시간이 몇 초 후인지 구하는 프로그램을 작성하시오.

입력

첫 번째 줄에 수빈이가 있는 위치 N과 동생이 있는 위치 K가 주어진다. N과 K는 정수이다.

출력

수빈이가 동생을 찾는 가장 빠른 시간을 출력한다.

예제 입력 1

5 17

예제 출력 1

4

힌트

수빈이가 5-10-9-18-17 순으로 가면 4초만에 동생을 찾을 수 있다.

W3sicHJvYmxlbV9pZCI6IjE2OTciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMyMjhcdWJjMTRcdWFmMmRcdWM5YzgiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzIxOFx1YmU0OFx1Yzc3NFx1YjI5NCBcdWIzZDlcdWMwZGRcdWFjZmMmbmJzcDtcdWMyMjhcdWJjMTRcdWFmMmRcdWM5YzhcdWM3NDQgXHVkNTU4XHVhY2UwIFx1Yzc4OFx1YjJlNC4gXHVjMjE4XHViZTQ4XHVjNzc0XHViMjk0IFx1ZDYwNFx1YzdhYyBcdWM4MTAgTigwICZsZTsgTiAmbGU7IDEwMCwwMDApXHVjNWQwIFx1Yzc4OFx1YWNlMCwgXHViM2Q5XHVjMGRkXHVjNzQwIFx1YzgxMCBLKDAgJmxlOyBLICZsZTsgMTAwLDAwMClcdWM1ZDAmbmJzcDtcdWM3ODhcdWIyZTQuJm5ic3A7XHVjMjE4XHViZTQ4XHVjNzc0XHViMjk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