当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5378:Leader in Tree Land

题目描述
Tree land has $n$ cities, connected by $n-1$ roads. You can go to any city from any city. In other words, this land is a tree. The city numbered one is the root of this tree.

There are $n$ ministers numbered from $1$ to $n$. You will send them to $n$ cities, one city with one minister.

Since this is a rooted tree, each city is a root of a subtree and there are $n$ subtrees. The leader of a subtree is the minister with maximal number in this subtree. As you can see, one minister can be the leader of several subtrees.

One day all the leaders attend a meet, you find that there are exactly $k$ ministers. You want to know how many ways to send $n$ ministers to each city so that there are $ k$ ministers attend the meet.

Give your answer mod $1000000007$.
输入解释
Multiple test cases. In the first line there is an integer $T$, indicating the number of test cases. For each test case, first line contains two numbers $n, k$. Next $n-1$ line describe the roads of tree land.

$T=10,1\leq n\leq 1000,1\leq k\leq n$
输出解释
For each test case, output one line. The output format is Case #$x$: $ans$, $x$ is the case number,starting from $1$.
输入样例
2
3 2
1 2
1 3
10 8
2 1
3 2
4 1
5 3
6 1
7 3
8 7
9 7
10 6
输出样例
Case #1: 4
Case #2: 316512
来自杭电HDUOJ的附加信息
Author UESTC
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5378

最后修改于 2020-10-25T23:22:10+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)