![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
概率期望
mmk27
这个作者很懒,什么都没留下…
展开
-
ZOJ - 3822 概率dp
Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboard with N rows and M columns.E...原创 2018-10-27 14:40:52 · 148 阅读 · 0 评论 -
2019南京网络赛 D.Robots 树上期望dp
题目链接:https://nanti.jisuanke.com/t/41301题意:N个点M条边的有向无环图,1为唯一入度为0的点,N为唯一出度为0的点,现在你从1号点出发,每单位时间,你有相同的概率,走向下一节点或原地不动。第 i 单位时间内你的消耗为 i ,询问你走到 N 点的期望消耗。题解:d[i]为i点到n点的期望天数dp[i] 为i点到n点的能量消耗期望#...原创 2019-09-04 23:19:44 · 236 阅读 · 1 评论 -
2019杭电多校第七场 HDU - 6656 Kejin Player 期望
题目链接:https://vjudge.net/problem/HDU-6656题解:维护一个前缀sum[i] : 从1到 i 的期望第 i 到达 i + 1是:ai + (1 - r[i] / s[i])*(sum[i] - sum[x[i]] + E) = E所以:E = (s[i] * ai + (s[i] - r[i] )* (sum[i] - sum[x[i]]))...原创 2019-08-13 20:42:47 · 161 阅读 · 0 评论 -
2019 杭电多校 HDU 6635 Nonsense Time LIS 随机序列LIS期望跟下n
题目链接:https://vjudge.net/problem/HDU-6635题意:n个数,原先都被覆盖了,每次显示一个数,求每次的LIS题解:1 到 N 的排列,最长上升子序列(LIS)长度的期望是多少:https://www.zhihu.com/question/266958886所以LIS大约是100,我们倒着操作,相当于每次去掉一个数,看一下这个数是不是LIS里的数,如果是的...原创 2019-08-08 16:56:14 · 343 阅读 · 0 评论 -
2018ccpc吉林 问题 D: THE MOON 概率dp
题意:Step 0. Let initial chance rate q = 2%.Step 1. Player plays a round of the game with winning rate p%.Step 2. If the player wins, then will go to Step 3 else go to Step 4.Step 3. Player gets a ...原创 2019-05-03 18:17:10 · 681 阅读 · 0 评论 -
HDU - 5245 Joyful 概率期望
题目链接:https://vjudge.net/problem/HDU-5245题意:n*m的矩阵方格,每次随机选取两个方格,这两个方格组成的矩形内所有方格染上颜色,进行k次,问有颜色方格的数目题解:计算每个方格染不上颜色的概率p,1-p即为有颜色的概率,每个方格权值为1,所有概率相加即可计算:染一次的 p = (所有情况 - 能染上的情况)/ 所有情况我是分了9种情况算的,...原创 2019-04-23 23:31:12 · 180 阅读 · 0 评论 -
biubiubiu坐地铁 期望dp
链接:https://ac.nowcoder.com/acm/contest/642/M来源:牛客网题目描述BiuBiuBiu 每次出去玩都要去坐地铁,BiuBiuBiu 观察到,当地铁上人比较少的时候,大家都会选择那些与其他人不相邻的座位,现在地铁上有 n 个座位排成一排,1 号座位与 2 号相邻,n 号座位与 n-1 号相邻,除了 1 号与 n 号座位,任意 i 号座位都与 i-...原创 2019-04-21 15:02:59 · 1247 阅读 · 1 评论 -
ZOJ - 2949 Coins of Luck 概率dp
题目链接:点击查看题意:至少要制多少次筛子才能有n次正面或n次反面题解:dp[i][j] = 1 + 0.5 * dp[i - 1][j] + 0.5 * dp[i][j - 1]#include<bits/stdc++.h>using namespace std;#define INF 0x3f3f3f3fint n,m;double dp[1010][1010...原创 2019-03-27 14:47:45 · 153 阅读 · 0 评论 -
ZOJ - 3605 Find the Marble 三维概率dp
题目链接:点击查看题意:一共有 n 个杯子,有一个石头开始是放在第 s 号杯子里,然后交换这些杯子 m 次,但是你只能知道其中的k次,每次概率相同,最后输出概率最大的杯子编号,概率相同输出编号小的题解:dp[i][j][k] 表示前i个选了j个第k个杯子的概率,那么前i个杯子第j个选和不选的概率是多少呢?选C(i-1,j-1) / C(i,j) = j / i;注意要取eps 1e-...原创 2019-03-22 12:00:47 · 153 阅读 · 0 评论 -
HDU - 4576 Robot 概率dp
Michael has a telecontrol robot. One day he put the robot on a loop with n cells. The cells are numbered from 1 to n clockwise. At first the robot is in cell 1. Then Michael uses a remote cont...原创 2019-01-01 17:25:37 · 199 阅读 · 0 评论 -
CodeForces - 500D New Year Santa Network 树形dp 记忆化 求期望
New Year is coming in Tree World! In this world, as the name implies, there are ncities connected by n - 1 roads, and for any two distinct cities there always exists a path between them. The cities ar...原创 2018-12-18 21:34:43 · 281 阅读 · 0 评论 -
CodeForces - 340C Tourist Problem
Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilom...原创 2018-12-03 19:49:09 · 138 阅读 · 0 评论 -
CodeForces - 280C Game on Tree 概率期望
Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of sever...原创 2018-11-20 13:11:32 · 201 阅读 · 0 评论 -
CodeForces 697D Puzzles 概率期望
Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is...原创 2018-11-20 16:35:36 · 172 阅读 · 0 评论 -
Gym - 101190F Foreign Postcards 概率期望
Fedor is an avid traveler. As a result of his hobby, he has gathered a big collection of postcards from all over the world. Each postcard has a unique picture on the front side and some fields for addr...原创 2018-11-02 12:11:31 · 311 阅读 · 0 评论 -
2019徐州网络赛 J、Random Access Iterator 树上 概率 dp
题目链接:https://nanti.jisuanke.com/t/41392题解:dp[u] 表示 u这个点向下能到达最深深度的概率,因为对于每个点要找k次,只要其中有一次能到达最深即可,所以我们用容斥的思想,即表示为 1 - 不能到达最深的概率,不能到达最深的概率就是k次都不能到达最深。#include <bits/stdc++.h>using namespace st...原创 2019-09-07 18:54:22 · 196 阅读 · 0 评论