1391: 01-K Code

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

Consider a code string S of N symbols, each symbol can only be 0 or 1. In any consecutive substring of S, the number of 0‘s differs from the number of 1‘s by at most K. How many such valid code strings S are there? For example, when N is 4, and K is 3, there are two invalid codes: 0000 and 1111.

输入

The input consists of several test cases. For each case, there are two positive integers N and K in a line. N is in the range of [1, 62]. K is in the range of [2, 5].

输出

Output the number of valid code strings in a line for each case.

样例输入 复制

1 2
4 3

样例输出 复制

2
14