No K Ones in a Row
Count the binary strings of length N with no K consecutive 1s, modulo 109+7.
Input: one line with two integers N and K.
Output: the count mod 109+7.
Constraints:
- 1 ≤ N ≤ 1018
- 1 ≤ K ≤ 6
Sample Tests
Input 1
3 2
Output 1
5
Input 2
1 1
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.