r***m 发帖数: 13 | 1 There is a sequence {a1, a2, a3, a4, ..... aN}. A run is the maximal
strictly increasing or strictly decreasing continuous part of the sequence.
Eg. If we have a sequence {1,2,3,4,7,6,5,2,3,4,1,2} We have 5 possible runs
{1,2,3,4,7}, {7,6,5,2}, {2,3,4}, {4,1} and {1,2}.
Given four numbers N, M, K, L. Count the number of possible sequences of N
numbers that has exactly M runs, each of the number in the sequence is less
than or equal to K and difference between the adjacent numbers is less than
equal to L. |
|