CF724F.Uniformly Branched Trees

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A tree is a connected graph without cycles.

Two trees, consisting of nn vertices each, are called isomorphic if there exists a permutation p:1,...,n1,...,np:{1,...,n}→{1,...,n} such that the edge (u,v)(u,v) is present in the first tree if and only if the edge (pu,pv)(p_{u},p_{v}) is present in the second tree.

Vertex of the tree is called internal if its degree is greater than or equal to two.

Count the number of different non-isomorphic trees, consisting of nn vertices, such that the degree of each internal vertex is exactly dd . Print the answer over the given prime modulo modmod .

输入格式

The single line of the input contains three integers nn , dd and modmod ( 1<=n<=10001<=n<=1000 , 2<=d<=102<=d<=10 , 108<=mod<=10910^{8}<=mod<=10^{9} ) — the number of vertices in the tree, the degree of internal vertices and the prime modulo.

输出格式

Print the number of trees over the modulo modmod .

输入输出样例

  • 输入#1

    5 2 433416647
    

    输出#1

    1
    
  • 输入#2

    10 3 409693891
    

    输出#2

    2
    
  • 输入#3

    65 4 177545087
    

    输出#3

    910726
    
首页