随机2
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
rand2
kirep觉得阮晔的题目太无聊了,kirep想要有趣一些。
阮晔 想知道将这 n 个串插入字典树后(即对于字典树中任意的叶子节点,存在这 n 个串中的某一个串使得与该叶子代表的字符串相等),字典树上节点个数的期望。
聪明的kirep很快就推出了ans = $\sum_{i=0}^{m} \left[1 - \left(1 - \frac{1}{26^i}\right)^n\right] 26^i$
由于答案可能很大,你需要输出答案对 998 244 353 取模后的结果。一下就水了两道题我真是个天才
Input
第一行输入两个整数 n,m(),分别表示字符串个数和字符串长度。
Output
输出一个整数,表示期望有多少个节点对 998 244 353 取模后的结果。对于期望节点个数,保证答案可以被表示成 的形式,其中 x,y 为整数,且 y 0 (mod 998 244 353),你需要输出 ⁻¹ mod 998 244 353,其中 y⁻¹ 表示 y 的逆元。
Examples
| standard input | standard output |
|---|---|
| 1 3 | 4 |
| 2 2 | 624641072 |
2025新生第二届周赛
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 8
- Start at
- 2025-11-15 14:00
- End at
- 2025-11-15 17:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 36