#P8362. [SNOI2022] 数位

[SNOI2022] 数位

Problem Description

Little S is a girl who likes counting.

One day, she was lying in bed counting before sleep. When she counted to 977431977431, she finally felt sleepy and decided to go to sleep. But then she suddenly noticed that the digits of this number are monotonically non-increasing. She found it quite interesting, and then she could not fall asleep again.

She wants to know how many numbers are between LL and RR whose digits are monotonically non-increasing. But this problem is too boring.

She then wants to know how many pairs (a,b)(a, b) are between LL and RR such that the digits of (a+b)(a + b) are monotonically non-increasing. But this problem is also too boring.

Finally, she came up with a more interesting problem:

Given integers L,R,kL, R, k, find how many kk-dimensional vectors (a1,a2,...,ak)(a_1, a_2, ..., a_k) satisfy that the digits of (a1+a2+...+ak)(a_1 + a_2 + ... + a_k) are monotonically non-increasing, and i[1,k],LaiR\forall i \in [1, k], L \leq a_i \leq R.

Since the answer may be very large, output it modulo 998244353998244353.

Input Format

The first line contains a positive integer LL, as described in the problem statement.

The second line contains a positive integer RR, as described in the problem statement.

The third line contains a positive integer kk, as described in the problem statement.

Output Format

Output one line with one integer, the number of valid vectors modulo 998244353998244353.

1
100
2
3728
19260817
1000000000
3
28745082
114514233
1919810233
10
135934411
样例 4 见附件 digit4.in
样例 4 见附件 digit4.ans
样例 5 见附件 digit5.in
样例 5 见附件 digit5.ans

Hint

Constraints

For all testdata, 1LR<1010001 \leq L \leq R < 10^{1000}, 1k501 \leq k \leq 50.

The detailed constraints are given in the table below.

Test Point R<R< kk
11 10610^6 11
22 1010
33 2020
44 3030
55 5050
66 101710^{17} 1010
77
88 2020
99 3030
1010 5050
1111 105010^{50} 22
1212 1010
1313 1010010^{100} 22
1414 33
1515 1010
1616 1020010^{200} 33
1717 1010
1818 1030010^{300}
1919
2020 2020
2121 1050010^{500} 1010
2222 2020
2323 10100010^{1000} 3030
2424 5050
2525

Translated by ChatGPT 5