Xâu Nhị Phân

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 1G
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, GAS64, Pascal, Perl, PHP, Python, Sed, TCL, Text

Cho 2 số nk (2kn600)

Hãy đếm xem có bao nhiêu xâu nhị phân độ dài n mà không có quá k số 0 hoặc k số 1 nào liên tiếp nhau.

Input: Gồm 1 dòng duy nhất là 2 số nk

Output: Gồm 1 dòng duy nhất là số dãy nhị phân thoả mãn

Ví dụ
Input:
Copy
3 2
Output:
Copy
6

Giải thích : Đó là các xâu 001 , 010 , 011 , 100 , 101 , 110.


Comments

Please read the guidelines before commenting.


There are no comments at the moment.