AtCoder Beginner Contest 449
G
Many Repunit Sum 2
AtCoder
⌀ 2631
原题
← D→

Many Repunit Sum 2 AI (CI翻译)

Problem Statement

You are given positive integers $N, M$.

For a positive integer $d$, define the repunit with $d$ digits as the integer $\displaystyle\sum_{i = 0}^{d - 1} 10^i$.

Find the number, modulo $998244353$, of integers that can be expressed as the sum of (not necessarily distinct) $N$ repunits, each with at least $1$ digit and at most $M$ digits.

Constraints

  • $1 \leq N \leq 10^5$
  • $1 \leq M \leq 10^9$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

N M

Output

Output the answer.

{"titleZh":"许多一次方和 2","bodyZh":"## 题目描述\n\n给定正整数 $N, M$。\n\n对于正整数 $d$,定义 $d$ 位的 repunit(由数字 1 组成的数)为整数 $\displaystyle\\sum_{i = 0}^{d - 1} 10^i$。\n\n求有多少个整数可以表示为恰好 $N$ 个(不必互不相同的)repunit 之和,其中每个 repunit 的位数至少为 $1$,至多为 $M$。答案对 $998244353$ 取模。\n\n## 约束条件\n\n- $1 \\leq N \\leq 10^5$\n- $1 \\leq M \\leq 10^9$\n- 所有输入值均为整数。\n\n## 输入格式\n\n输入从标准输入按以下格式给出:\n\n\nN M\n\n\n## 输出格式\n\n输出答案。"}AI (CI翻译)

样例

Input #1
2 3
Output #1
6
We have $3$ repunits with at least $1$ digit and at most $3$ digits: $1, 11, 111$. As the sum of $2$ of them, we can express $6$ integers: $2, 12, 22, 112, 122, 222$.
Input #2
10 10
Output #2
92378
Input #3
12345 123456789
Output #3
133394021
题目信息
题号
abc449_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。