QOJ.ac

QOJ

Límite de tiempo: 12 s Límite de memoria: 256 MB Puntuación total: 100

#4521. 树木看台 / 精灵

Estadísticas

树架(Tree Stands)是安装在树上的高架木制平台。通常,猎人使用树架来观察或射击猎物。

在我们的县里,猎人们建造了一个非凡的树架系统。树架由狭窄的直线路径连接,在狩猎场上形成了一种迷宫。建造者希望尽量减少对环境的影响,因此他们建造了最少数量的路径,以确保任意两个树架之间都是连通的。此外,当且仅当两个树架由一条路径直接相连时,它们才是相互可见的。

一群当地猎人想要找出哪些特定的树架最符合他们的狩猎需求。每天,他们都会攀登一组不同的树架并观察野生动物。

还有几个重要的条件需要考虑:

  • 安全规则规定,任何被占用的树架必须至少能被另一个被占用的树架看到,以便在紧急情况下,邻近树架上的猎人可以前来帮助同事。
  • 一个树架上最多只能有一名猎人。
  • 哪位猎人在哪个树架上并不重要。重要的是哪些树架被占用,哪些没有。
  • 猎人群体的大小保持不变。

在他们调查完所有可用的树架选择方案之前,这群猎人将在树架上度过多少天?

输入格式

输入包含多个测试用例。每个测试用例的第一行包含两个整数 $N$ 和 $K$ ($2 \le K \le N \le 200$),中间用空格隔开。$N$ 是树架的数量,$K$ 是猎人群体的大小。树架的编号为 $1, 2, 3, \dots, N$。

接下来有 $N - 1$ 行,每行指定两个树架之间的一条路径。该行包含用空格隔开的两个树架编号。输入中路径的顺序以及每行中编号的顺序是任意的。

输出格式

对于每个测试用例,在单独的一行上打印该群体在树架上度过的天数。结果请对 $1\,000\,000\,007$ 取模。

样例

输入 1

4 3
1 2
1 4
1 3
5 4
1 2
2 3
3 4
4 5

输出 1

3
3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.