Logo
(追記) (追記ここまで)

34437번 - Number Reduction 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB149998966.917%

문제

Christopher loves the number one. In fact, he loves it so much that if he ever has more than one of something, he makes sure to get rid of all but one of his items. Christopher has one pencil, one notebook, one sweatshirt, and so on.

However, Christopher has gotten bored of just giving away all but one of his possessions of each type. Instead, he has come up with a new strategy, which depends on the number of items he has already. If he has an even number of something, then he will give away half of what he has. If he has an odd number of things, then he will buy some more of that item: he will add twice as many items as he currently has, plus one more item, to his collection. He does this until he has just one item left.

For example, if he has 5ドル$ phone chargers, then to get rid of them he would first buy 11ドル$ more (for a total of 16ドル$), then give away 8ドル,ドル then give away 4ドル,ドル then give away 2ドル,ドル then give away 1ドル$.

Christopher wants to know how long it will take to get rid of his items using this technique.

Given a number, you must tell Christopher how many steps the technique takes to convert the number to one. For example, for the number 5ドル$ above, the number of steps needed would be 5ドル$.

입력

The input consists of one integer, $N$ (1ドル \leq N \leq 100\ 000$).

출력

Output the number of steps it takes for the input number to be converted to one.

제한

예제 입력 1

5

예제 출력 1

5

예제 입력 2

8

예제 출력 2

3

노트

출처

School > CS@Mines > CS@Mines HSPC 2019 B번

  • 문제를 만든 사람: Jordan Newport
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /