CF280C Game on Tree

题目描述

给定一棵有根树,结点编号从 $1$ 到 $n$。根结点为 $1$ 号结点。 对于每一次操作,等概率的选择一个**尚未被删去**的结点并将它及其子树全部删去。当所有结点被删除之后,游戏结束;也就是说,删除 $1$ 号结点后游戏即结束。 要求求出删除所有结点的期望操作次数。

输入格式

输出格式

说明/提示

In the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: $ 1×(1/2)+2×(1/2)=1.5 $ In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus the expected steps are: $ 1×(1/3)+(1+1.5)×(2/3)=(1/3)+(5/3)=2 $