当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7060:Separated Number

题目描述
Cathy loves numbers, and recently she fell in love with the separation of numbers.

A separation of a number is defined as dividing the number into contiguous parts. For example, we can call ($11$)($451$)($4$) a separation of the number $114514$. The value of one separation is the sum of all the separated parts(the value of ($11$)($451$)($4$) equals to $11$+$451$+$4$=$466$). If one part has leading zeros, it is also valid, so the separation ($1$)($00$) of number $100$ is a valid separation too. Now Cathy has a number $x$ without leading zeros, and she wants to know the total value of separations which divide the number into no more than $k$ parts. She is not quite smart so she asked you for help.

Since the answer may be very large, you only need to output the answer modulo $998244353$.
输入解释
The first line contains a number $T$($1 \leq T \leq 5$), the number of testcases.

For each testcase, there are two lines.
The first line contains a number $k$, the maximum number of parts.
The second line contains a number $x$, the queried number.

Let $n$ be the number of digits of $x$, and we will have $1 \leq n \leq 10^6$ and $1 \leq k \leq n$.

It is guaranteed that for all testcases, $\sum{n} \leq 10^6$.
输出解释
For each testcase, output one number in one line, the answer modulo $998244353$.
输入样例
1
3
100
输出样例
112
来自杭电HDUOJ的附加信息
Hint In the sample, there are 4 possible separations with no more than 3 parts, (100),(1)(00),(10)(0),(1)(0)(0), and their values are 100, 1+0=1, 10+0=10, 1+0+0=1 respectively, so the answer will be 100+1+10+1=112.

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7060

最后修改于 2021-10-23T19:11:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)