K-permutation
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Let's call a permutation of n numbers 1 ... n a k - permutation if any two adjacent elements in it differ by no more than k.
Find the number of k-permutations from the numbers 1 ... n.
Input
Two integers n, k (1 ≤ k ≤ n ≤ 9).
Output
Print the number of k-permutations from the numbers 1 ... n.
Examples
Input #1
Answer #1
Submissions 921
Acceptance rate 44%