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

24280번 - Present10 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB144450.000%

문제

Let us consider a sequence of alternatively changing zeroes and ones, starting with one. This sequence can be seen as a binary representation of a positive integer. We want to present it as a sum of different binary numbers, composed only of ones (i.e. 1, 11, 111 and etc). For some sequences such presentation is possible, for others not.

For example: 10102=112+1112; 10101012=1112+11112+1111112; 101010101012 cannot be presented as desired.

Write a program to find for a given sequence of zeros and ones the number of summands in one presentation as a sum of different binary numbers, composed only of ones, or determines that there is no such presentation.

입력

The first line of the standard input contains only one positive integer n – the length of the considered sequence.

출력

The only line of the standard output should only contain one non-negative integer: the number of different summands of the desired presentation or 0, if there is no such presentation.

If there is more than one possible solution, output the number of summands in any of them.

제한

  • 1 ≤ n ≤ 2·109

서브태스크

번호배점제한
110

n ≤ 60

220

n ≤ 103

330

n ≤ 106

440

n ≤ 2·109

예제 입력 1

6

예제 출력 1

4

1010102=12+112+1112+111112 (42=1+3+7+31)

예제 입력 2

5

예제 출력 2

0

The number 101012=21 cannot be presented as desired.

힌트

출처

Olympiad > International Autumn Tournament in Informatics > 2019 > Group A (Seniors) 5번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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