Q 1117: K-Decimal number
Time limit: 1Sec Memory Limit: 128MB
Title Description
Consider a K-decimal number containing N digits. Define a number to be valid if its K-decimal representation does not contain two consecutive zeros.
Example. 1010230 is a valid 7-digit number 1000198 is invalid 0001235 is not a 7-digit number, but a 4-digit number.
Given two numbers N and K, calculate the total number of valid K-digit numbers that contain N digits.
Assume that 2 <= K <= 10; 2 <= N; 4 <= N+K <= 18.
Input
Two decimal integers N and K
Output
Decimal representation of the result
Sample Input
|
|
Sample Output
|
|
C Code
|
|