HBC237535[SCOI2009]生日礼物,枚举,尺取法Disease题解

庄子墨 算法基础篇 90 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
Gates is a super rich man . Because of the influence of COVID-19 , he had to do enough protection .To keep himself away from the virus , he formulated strict protective measures .v may contact with each other , if one of them is infected with the virus , then the other one has. n1 edges from a tree , Gates is the root .The level of a person is defined as the depth of him on the tree .probability of infecting the virus from the outside world .We define the disaster value as the lowest level of the person who infected of the virus . .Now please help Gates to calculate what's the expectation of the disaster value ?

Gates is a super rich man . Because of the influence of COVID-19 , he had to do enough protection . To keep himself away from the virus , he formulated strict protective measures . Gates has exactly n-1 n−1 servants , he numbers them 2 2 to n n (Gates is number 1 1) , and n-1 n−1 edges (u,v,a,b) (u,v,a,b) satisfies that u u and v v may contact with each other , if one of them is infected with the virus , then the other one has frac {a}{b} b a ​ probability of being infected . We promise that the n-1 n−1 edges from a tree , Gates is the root . The level of a person is defined as the depth of him on the tree (Gates's level is always 1) . Now we know for the i-th i−th person , he has frac {p_i}{q_i} q i ​ p i ​ ​ probability of infecting the virus from the outside world (At the beginning) . We define the disaster value as the lowest level of the person who infected of the virus . ( If there are no one infected , the disaster value is 0 ) . Now please help Gates to calculate what's the expectation of the disaster value ?

HBC237535[SCOI2009]生日礼物,枚举,尺取法Disease题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC237535[SCOI2009]生日礼物 枚举 尺取法Disease题解