872. Recursive Tree

A sequence of rooted trees Tn is constructed such that Tn has n nodes numbered 1 to n.

The sequence starts at T1, a tree with a single node as a root with the number 1.

For n>1, Tn is constructed from Tn1 using the following procedure:

For example, the following figure shows T6 and T7. The path traced through T6 during the construction of T7 is coloured red.

Let f(n,k) be the sum of the node numbers along the path connecting the root of Tn to the node k, including the root and the node k. For example, f(6,1)=6+5+1=12 and f(10,3)=29.

Find f(1017,917).

872. 递归生成的树

我们按如下规则生成一列有根树 {Tn},使得 Tn 恰有标号为 1nn 个结点。初始时,T1 是只含 1 号结点且以该结点为根的有根树。

对诸 n>1,我们按如下流程,用 Tn1 构造 Tn

下图展示了用 T6 构造出 T7 的过程,第一步中走出的路径已被标红。

f(n,k) 为:从 Tn 的根节点到 k 号结点的最短路径上,所有结点(包括根节点、k 号结点)标号的和。例如,f(6,1)=6+5+1=12f(10,3)=29

f(1017,917)


这个链接 回到源站。

这个链接 回到详细版题目目录。