CF1051E.Vasya and Big Integers
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasya owns three big integers — a,l,r. Let's define a partition of x such a sequence of strings s1,s2,…,sk that s1+s2+⋯+sk=x, where + is a concatanation of strings. si is the i-th element of the partition. For example, number 12345 has the following partitions: ["1", "2", "3", "4", "5"], ["123", "4", "5"], ["1", "2345"], ["12345"] and lots of others.
Let's call some partition of a beautiful if each of its elements contains no leading zeros.
Vasya want to know the number of beautiful partitions of number a, which has each of si satisfy the condition l≤si≤r. Note that the comparison is the integer comparison, not the string one.
Help Vasya to count the amount of partitions of number a such that they match all the given requirements. The result can be rather big, so print it modulo 998244353.
瓦西里拥有三个大整数:a、l 和 r。我们定义 x 的一个划分为一个字符串序列 s1,s2,…,sk,使得 s1+s2+⋯+sk=x,其中 + 表示字符串拼接运算,si 是该划分的第 i 个元素。例如,数字 12345 具有如下划分:["1", "2", "3", "4", "5"]、["123", "4", "5"]、["1", "2345"]、["12345"],以及许多其它划分。
若某个 a 的划分中每个元素均不含前导零,则称其为优美的划分。
瓦西里想知道:满足如下条件的 a 的优美划分的数量是多少?即对划分中的每个元素 si,均满足 l≤si≤r。注意,此处的比较是整数比较,而非字符串字典序比较。
请帮助瓦西里计算满足所有给定条件的 a 的划分数量。结果可能非常大,请对 998244353 取模后输出。
输入格式
The first line contains a single integer a (1≤a≤101000000).
The second line contains a single integer l (0≤l≤101000000).
The third line contains a single integer r (0≤r≤101000000).
It is guaranteed that l≤r.
It is also guaranteed that numbers a,l,r contain no leading zeros.
第一行包含一个整数 a (1≤a≤101000000)。
第二行包含一个整数 l (0≤l≤101000000)。
第三行包含一个整数 r (0≤r≤101000000)。
保证 l≤r。
同时保证数字 a,l,r 均不含前导零。
输出格式
Print a single integer — the amount of partitions of number a such that they match all the given requirements modulo 998244353.
输出一个整数——满足所有给定要求的数字 a 的划分方案数,对 998244353 取模。
输入输出样例
输入#1
135 1 15
输出#1
2
输入#2
10000 0 9
输出#2
1
说明/提示
In the first test case, there are two good partitions 13+5 and 1+3+5.
In the second test case, there is one good partition 1+0+0+0+0.
在第一个测试用例中,存在两个好的划分:13+5 和 1+3+5。
在第二个测试用例中,存在一个好的划分:1+0+0+0+0。
输入解题思路,AI测评打分。不知道怎么写?