G - Count Strictly Increasing Sequences Editorial by en_translator
Let be “the number of ways to determine the -th and later digits of such that within those digits.” (DP stands for Dynamic Programming.) Here, within the specified segment, the -th digits are weakly increasing; additionally, within a segment with the same -th digits, the -th and later digits must form weakly increasing integers. Thus, the DP can be evaluated by considering the ways to split into segments where the -th segments are 0
, 1
, , and 9
. Specifically, we evaluate “the number of ways to determine the -th and later digits of such that within those digits and zero or more first -th digits are ,” which can be evaluated in a total of time (where is the number of kinds of digits).
posted:
last update: