QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#3227. 子串对

統計

Snuke 想到了一个字符串对 $(s, t)$,但他忘记了具体内容。他只记得以下信息:

  • $s$ 的长度恰好为 $N$。
  • $t$ 的长度恰好为 $M$。
  • $t$ 是 $s$ 的子串。(即你可以从 $s$ 中选出连续的 $M$ 个字符,使得它们与 $t$ 相同。)

计算满足条件的字符串对 $(s, t)$ 的数量,结果对 $10^9 + 7$ 取模。假设字母表的大小为 $A$。

输入格式

输入的第一行包含三个整数 $N, M$ 和 $A$ ($1 \le N \le 200, 1 \le M \le 50, M \le N, 1 \le A \le 1000$)。

输出格式

输出满足上述条件的字符串对 $(s, t)$ 的数量,对 $10^9 + 7$ 取模。

样例

样例输入 1

3 2 2

样例输出 1

14

样例输入 2

200 50 1000

样例输出 2

678200960

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.