#abc292g. G - Count Strictly Increasing Sequences
G - Count Strictly Increasing Sequences
Score : points
问题陈述
你将获得一个长度为 的字符串序列 ,由数字字符(0123456789
)和 ?
组成。
其中共有 个 ?
,存在 种独立替换 ?
为数字的方式。在所有这些方式中,有多少种使得替换后的字符串作为整数时满足 ?请找出这个计数结果对 取模的值。
需要注意的是,替换后的字符串可能包含前导零。例如,0000000292
被视为整数 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length- strings consisting of digits (0123456789
) and ?
.
There are ways to replace the occurrences of ?
with digits independently, where is the total number of ?
in . Among them, how many satisfy when the resulting strings are seen as integers? Find this count modulo .
The resulting strings may have leading zeros. For instance, 0000000292
is seen as .
Constraints
- and are integers.
- is a string of length consisting of digits and
?
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 2
?0
??
05
Sample Output 1
4
Here are the four desired replacements.
- Replace the first character of with
0
, and the first and second characters of with0
and1
, respectively. - Replace the first character of with
0
, and the first and second characters of with0
and2
, respectively. - Replace the first character of with
0
, and the first and second characters of with0
and3
, respectively. - Replace the first character of with
0
, and the first and second characters of with0
and4
, respectively.
Sample Input 2
2 1
0
0
Sample Output 2
0
Sample Input 3
10 10
1?22??37?4
1??8?0??49
3?02??8044
51?4?8?7??
5?9?20???2
68?7?6?800
?3??2???23
?442312158
??2??921?8
????5?96??
Sample Output 3
137811792
Find the count modulo .
update @ 2024/3/10 12:11:27