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

6190번 - Another Cow Number Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB99261657164.886%

문제

The cows are playing a silly number game again. Bessie is tired of losing and wants you to help her cheat. In this game, a cow supplies a number N (1 <= N <= 1,000,000). This is move 0. If N is odd, then the number N is multiplied by 3 and incremented by 1. If N is even, the number N is divided by 2. Each time the number is multiplied or divided, the score increases by one point. The game ends -- and the score is finalized -- when N becomes 1. If N is initially 1, the score is 0.

Here's an example with N starting at 5:

 N Next Value Comment Score
 5 16 3*5+1 1
 16 8 16/2 2
 8 4 8/2 3
 4 2 4/2 4
 2 1 2/2 5

The final score is 5.

입력

  • Line 1: A single integer, N

출력

  • Line 1: A single integer that is the score for this game when starting at N

제한

예제 입력 1

112

예제 출력 1

20

힌트

출처

Olympiad > USA Computing Olympiad > 2006-2007 Season > USACO October 2006 Contest > Gold 1번

  • 데이터를 추가한 사람: kcm1700
(追記) (追記ここまで)

출처

대학교 대회

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

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