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

建议使用的浏览器:

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

6540:Neko and tree

题目描述
Neko has a tree with $n$ nodes.
There are $m$ key nodes on tree. Neko want to you to selecte some key nodes satisfying the distance between any two selected nodes less than or equal to $k$.
Neko thinks this work is too easy,so Neko want to know how many different way for selecting nodes.
Calculate the answer after mod $10^9+7$.
Note that you have to select at least one key node.
输入解释
The first line contains three integers $n, m, k(1 \leq n,m,k \leq 5000)$.
The next $n-1$ line, each line contains two integers $u, v$,indicating there is an edge connecting node $u$ and node $v$.
The last line contains $m$ integers, indicating key node.
输出解释
Output the number of way for selecting nodes.
输入样例
4 3 2
1 2
1 3
2 4
2 3 1
输出样例
7
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6540

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

共提交 0

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