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

建议使用的浏览器:

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

6091:Rikka with Match

题目描述
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:

Yuta has an undirected connected graph $G=\langle V,E \rangle$ with $n$ nodes and $n-1$ edges. Yuta can choose some edges in $E$ and remove them. It is clear that Yuta has $2^{n-1}$ different ways to remove.

Now, Yuta want to know the number of ways to remove the edges which make the maximum matching size of the remaining graph $G’$ is divisible by $m$.

It is too difficult for Rikka. Can you help her?  

An edge set $S$ is a match of $G=\langle V,E \rangle$ if and only if each nodes in $V$ connects to at most one edge in $S$. The maximum matching of graph $G$ is defined as the match of $G$ with the largest size.
输入解释
The first line contains a number $t(1 \leq t \leq 100)$, the number of the testcases. And there are no more than $3$ testcases with $n > 1000$.

For each testcase, the first line contains two numbers $n,m(1 \leq n \leq 5 \times 10^4,1 \leq m \leq 200)$.

Then $n-1$ lines follow, each line contains two numbers $u,v$ which describes an edge in $G$.
输出解释
For each testcase, print a single line with a single number -- the answer modulo $998244353$.
输入样例
1
4 2
1 2
2 3
3 4
输出样例
3
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6091

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

共提交 0

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