| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 102 | 21 | 16 | 35.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.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 30 | N ≤ 106 |
| 2 | 30 | 106 < N ≤ 109 and k ≤ 7 |
| 3 | 40 | 109 < N ≤ 1015 and k ≤ 50 |
15 3
45
S=7+11+13+14=45
Olympiad > Balkan Olympiad in Informatics > Junior Balkan Olympiad in Informatics > JBOI 2018 1번