#P4295. [SCOI2003] 严格N元树

    ID: 3231 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>高精度2003四川各省省选前缀和差分

[SCOI2003] 严格N元树

Description

If every non-leaf node of a tree has exactly nn children, we call it a strict nn-ary tree. If the deepest nodes in the tree have depth dd (the root has depth 00), then we call it a strict nn-ary tree of depth dd. For example, there are three strict 22-ary trees of depth 22, as shown below:

Given n,dn, d, write a program to count the number of strict nn-ary trees of depth dd.

Input Format

Contains only two integers n,dn, d (0<n320 < n \le 32, 0d160 \le d \le 16). The testdata guarantees that you do not need to consider trees with more than 10241024 nodes on any level (i.e., nd1024n^d \le 1024).

Output Format

Contains only one number, which is the number of strict nn-ary trees of depth dd.

2 2
3
2 3
21
3 5
58871587162270592645034001

Hint

The answer is guaranteed to be at most 200200 decimal digits.

Translated by ChatGPT 5