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

建议使用的浏览器:

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

7115:Vertex Deletion

题目描述
Given a tree with $n$ vertices, you can delete any vertex you like. We call a way of deletion beautiful if, in the remaining part of the tree, every vertex has at least one vertex still connected to it. You need to calculate how many ways of deletion are beautiful.

Two ways of deletion are considered the same if the set of the deleted vertex is the same.
输入解释
This problem contains multiple test cases.

The first line contains an integer $T$ indicating the number of test cases.

For each test case, the first line contains one integer $n$ ($1 \leq n \leq 10 ^ 5$).

The next $n - 1$ lines each contains two integers $u$ and $v$ ($1 \leq u, v \leq n,u\neq v$), representing an edge (u, v).

It's guaranteed that $\sum{n} \leq 10 ^ 6$.
输出解释
Output $T$ lines, each line contains an integer indicating the answer.

Since the answer can be very large, you only need to output the answer modulo $998244353$.
输入样例
1
6
1 2
1 3
2 4
2 5
3 6
输出样例
22

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

源链接: HDU-7115

最后修改于 2021-10-23T19:11:33+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 262144/262144K(Java/Others)