codeforces 280 C Game on Tree (离散概率)
来源:互联网 发布:淘宝店家 快递信息 编辑:程序博客网 时间:2024/05/23 01:12
题意:
给一棵树。
每次等可能地选个节点,去掉其代表的子树。
求消掉整棵树的期望。
思路:
把最终的期望看成是每个节点的期望值和。
消掉一个节点有两种方式
1)消去祖先
2)该节点被直接选择
E(u) = 1 * 1 / dep(u) + 0 * 1 / ( dep(u) - 1 )
dep(u) 等于根到u的路径上的节点数
void dfs(int fa, int u, int dep) { ans += 1.0 / dep; for(int v:graph[u]) if ( v != fa ) dfs(u, v, dep + 1);}
0 0
- codeforces 280 C Game on Tree (离散概率)
- CodeForces 280C Game on Tree 概率
- Codeforces 280 C. Game on Tree (概率与期望)
- Codeforces 280C Game on Tree 概率dp 树上随机删子树 求删完次数的期望
- codeforces 280C Game on Tree
- Codeforces 280C Game on Tree 树形期望dp
- Round #172 (Div. 1) C. Game on Tree——概率
- CodeForce 280C Game on Tree -- 树形dp求期望
- Codeforces 570 B. Simple Game ( 概率 )
- Codeforces 396C On Changing Tree(树状数组)
- Codeforces 482C Game with Strings(dp+概率)
- [agc017d]Game on Tree
- CodeForces -Game on Paper
- uva1636(离散概率)
- uva1636(离散概率)
- uva10491(离散概率)
- Educational Codeforces Round 30 C. Strange Game On Matrix
- Codeforces 873C Strange Game On Matrix【贪心】水题
- 【CCF】最优配餐
- java操作mongodb(聚合函数)-分组找出每组的最大值
- blueStacks模拟器竖屏调整
- android中用Spannable在TextView中设置超链接、颜色、字体
- 锋利的Jquery【读书笔记】 -- 第二章 jQuery选择器
- codeforces 280 C Game on Tree (离散概率)
- 全面分析:内部无法使用映射的公网来访问内部服务器的原因
- Lecture1-4Components of ML
- UART是什么
- jQuery学习之滑动
- 别忙,我先感觉一下自己
- (一)初学用markdown编辑文字的几种常见语法
- 如何在windows中使用cmd命令去编译,运行C++程序
- Redis安装和启动