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

16005번 - Kbin 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB102211635.556%

문제

We call the k-binary number a natural number which has in its binary representation exactly k digits of 1. For example, the 23 is a 4-binary number because the binary representation is 10111 and contains 4 digits of 1.

Given the N and k values, calculate the sum S of all k-binary numbers which are strictly lower than N. Because the sum is very large, you have to calculate modulo 1234567.

입력

The standard input contains the values N and k separated by a single space.

출력

The standard output will contain the number S modulo 1234567.

제한

  • 2 ≤ N ≤ 1015
  • 0 ≤ K ≤ 50

서브태스크

번호배점제한
130

N ≤ 106

230

106 < N ≤ 109 and k ≤ 7

340

109 < N ≤ 1015 and k ≤ 50

예제 입력 1

15 3

예제 출력 1

45

힌트

  • 1 – 1
  • 2 – 10
  • 3 – 11
  • 4 – 100
  • 5 – 101
  • 6 – 110
  • 7 – 111
  • 8 – 1000
  • 9 – 1001
  • 10 – 1010
  • 11 – 1011
  • 12 – 1100
  • 13 – 1101
  • 14 – 1110

S=7+11+13+14=45

출처

Olympiad > Balkan Olympiad in Informatics > Junior Balkan Olympiad in Informatics > JBOI 2018 1번

채점 및 기타 정보

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

출처

대학교 대회

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

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