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

4441번 - Saruman’s Level Up 다국어

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

문제

Saruman’s army of orcs and other dark minions continuously mine and harvest lumber out of the land surrounding his mighty tower for N continuous days. On day number i, Saruman either chooses to spend resources on mining coal and harvesting more lumber, or on raising the level (i.e., height) of his tower. He levels up his tower by one unit only on days where the binary representation of i contains a total number of 1’s that is an exact multiple of 3. Assume that the initial level of his tower on day 0 is zero.

For example, Saruman will level up his tower on day 7 (binary 111), next on day 11 (binary 1011) and then day 13, day 14, day 19, and so on.

Saruman would like to forecast the level of his tower after N days. Can you write a program to help?

입력

The input file will contain multiple input test cases, each on a single line. Each test case consists of a positive integer N < 1016, as described above. The input ends on end of file.

출력

For each test case, output one line: “Day N: Level = L”, where N is the input N, and L is the number of levels after N days.

제한

예제 입력 1

2
19
64

예제 출력 1

Day 2: Level = 0
Day 19: Level = 5
Day 64: Level = 21

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2012 Pacific Northwest Region Programming Contest G번

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

출처

대학교 대회

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

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