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

建议使用的浏览器:

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

6836:Expectation

题目描述
You are given an undirected graph consisting of $n$ vertices with $m$ weighted edges. We define the weight of a spanning tree as the bitwise AND of all edges' weight in spanning tree.

Now select a spanning tree randomly, you should calculate the expected value of the weight of this spanning tree. You are required to print the result mod $998244353$. $i.e.$, print $x \times y^{-1}$ mod $998244353$ where $x \times y ^ {-1}$ is the irreducible fraction representation of the result, where $y ^ {-1}$ denotes the multiplicative inverse of $y$ modulo $998244353$.


输入解释
The first line is an integer $t(1 \leq t \leq 10)$, the number of test cases.

For each test case, there are two space-separated integers $n(2 \leq n \leq 100)$ and $m(1 \leq m ≤ 10^{4})$ in the first line, the number of nodes and the number of edges.

Then follows $m$ lines, each contains three integers $u, v, w(1 \leq u, v, \leq n, 1 \leq w \leq 10^{9}, u \neq v)$, space separated, denoting an weight edge between $u$ and $v$ has weight $w$.

输出解释
For each test case, output a single line with a single integer, denoting the answer.
输入样例
1
3 3 
1 2 1 
1 3 1
2 3 1
输出样例
1
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6836

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

共提交 0

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