P2973 [USACO10HOL]赶小猪Driving Out the Piggi…

一个无向图,节点1有一个炸弹,在每个单位时间内,有p/q的概率在这个节点炸掉,有1-p/q的概率随机选择一条出去的路到其他的节点上。问最终炸弹在每个节点上爆炸的概率。

输入格式:

 

* Line 1: Four space separated integers: N, M, P, and Q

* Lines 2..M+1: Line i+1 describes a road with two space separated integers: A_j and B_j

 

输出格式:

 

* Lines 1..N: On line i, print the probability that city i will be destroyed as a floating point number. An answer with an absolute error of at most 10^-6 will be accepted (note that you should output at least 6 decimal places for this to take effect).

 

输入输出样例

输入样例#1: 复制
2 1 1 2 
1 2 
输出样例#1: 复制
0.666666667 
0.333333333 
posted @ 2018-05-20 11:44  planche  阅读(84)  评论(0编辑  收藏  举报