QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 64 MB Puntuación total: 100

#11051. 道路网络规划的枚举

Estadísticas

Byteman 准备开车环游 Byteland,但不幸的是他买不到该国的地图。他的朋友们告诉了他一些关于 Byteland 道路网络的信息:

  • Byteland 有 $n$ 个城市,编号从 $1$ 到 $n$。
  • 每条道路都是双向的,连接两个不同的城市。
  • 任意两个不同的城市之间恰好存在一条路径(由一条或多条道路组成),且路径上不会重复经过任何城市。
  • 最长的路径(即不重复经过任何城市的最长路径)包含 $d$ 条道路。

利用收集到的信息,Byteman 打算尝试重建 Byteland 的道路地图。Byteman 不想在这上面花费太多精力,因此他想知道满足给定条件的道路网络方案总数。在比较方案时,Byteman 不考虑城市的具体位置,只考虑连接关系;此外,他也不关心城市的具体编号。换句话说,当且仅当存在一个从一个方案的城市到另一个方案的城市的双射,使得如果城市 $u$ 和 $v$ 在第一个方案中由一条道路连接,那么它们的对应城市 $u'$ 和 $v'$ 在第二个方案中也由一条道路连接时,Byteman 认为这两个方案是相同的。

请编写一个程序:

  • 从标准输入读取整数 $n$、$d$ 和 $p$。
  • 计算符合 Byteman 所收集信息的不同道路网络方案数量,结果对 $p$ 取模。
  • 将结果输出到标准输出。

输入格式

输入的第一行也是唯一一行包含三个整数 $n$、$d$ 和 $p$($1 \le n \le 200$,$0 \le d < n$,$n < p \le 10^9$,$p$ 为质数),以空格分隔。

输出格式

输出的第一行也是唯一一行应包含一个整数,即符合 Byteman 已知条件的方案总数除以 $p$ 的余数。

样例

输入 1

6 3 13

输出 1

2

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.