Problem
As in the case of unrooted trees, say that we have a fixed collection of taxa labeling the leaves of a rooted binary tree . You may like to verify that (by extension of “Counting Phylogenetic Ancestors”) such a tree will contain internal nodes and total edges. Any edge will still encode a split of taxa; however, the two splits corresponding to the edges incident to the root of will be equal. We still consider two trees to be equivalent if they have the same splits (which requires that they must also share the same duplicated split to be equal).
Let represent the total number of distinct rooted binary trees on labeled taxa.
Given: A positive integer ().
Return: The value of modulo 1,000,000.
就像无根树木一样,假设我们有固定的 标记有根的二叉树的叶子的分类单元。您可能想验证(通过扩展“系统进化祖先”的计数)这样的树是否包含 内部节点和 总边。任何边缘将仍编码一个分裂类群; 但是,这两个裂口对应于入射到将相等。如果两棵树具有相同的拆分,我们仍然认为它们是等效的(这要求它们也必须共享相同的重复拆分才能相等)。
让 表示上的不同根二叉树的总数 标记的分类单元。
给定:正整数 ()。
返回值: 模1,000,000
Sample Dataset
4
Sample Output
15