Problem
Two unrooted binary trees and having the same labeled leaves are considered to be equivalent if there is some assignment of labels to the internal nodes of and so that the adjacency lists of the two trees coincide. As a result, note that and must have the same splits; conversely, if the two trees do not have the same splits, then they are considered distinct.
Let denote the total number of distinct unrooted binary trees having labeled leaves.
Given: A positive integer ().
Return: The value of modulo 1,000,000.
两个无根二叉树 和 具有相同 如果对标签的内部节点分配了一些标签,则标记为标签的叶子被认为是等效的 和 这样两棵树的邻接列表重合。结果,请注意 和 必须有相同的分割;相反,如果两棵树没有相同的分割,则将它们视为不同的。
让 表示具有的不同无根二叉树的总数 标记的叶子。
给定:正整数 ()。
返回值: 模1,000,000
Sample Dataset
5
Sample Output
15