题目链接:LightOJ - 1248 Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dice, the probability…
题目链接:https://vjudge.net/problem/LightOJ-1248 1248 - Dice (III)    PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see a…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1248 题意:有一个 n 面的骰子,问至少看到所有的面一次的所需 掷骰子 的 次数的期望: 第一个面第一次出现的概率是p1 n/n; 第二个面第一次出现的概率是p2 (n-1)/n; 第三个面第一次出现的概率是p3 (n-2)/n; ... 第 i 个面第一次出现的概率是pi (n-i+1)/n; 先看一下什么是几何分布: 几何分布: 在第n次伯努利试验中,试验 k 次才得到第一次成功…
学习博客:戳这里 题意:有一个 n 面的骰子,问至少看到所有的面一次的所需 掷骰子 的 次数的期望: 第一个面第一次出现的概率是p1 n/n; 第二个面第一次出现的概率是p2 (n-1)/n; 第三个面第一次出现的概率是p3 (n-2)/n; ... 第 i 个面第一次出现的概率是pi (n-i+1)/n; 先看一下什么是几何分布: 几何分布: 在第n次伯努利试验中,试验 k 次才得到第一次成功的机率为p.详细的说是:前k-1次皆失败,第k次成功的概率为p. 几何分布的期望E(X) = 1/p;…
题意:给出一个n面的色子,问看到每个面的投掷次数期望是多少. 析:这个题很水啊,就是他解释样例解释的太...我鄙视他,,,,, dp[i] 表示 已经看到 i 面的期望是多少,然后两种选择一种是看到新的一面,另一种是看到旧的一面,然后就很出答案了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include &…
Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dice, the probability of occurring any fa…
期望,$dp$. 设$dp[i]$表示当前已经出现过$i$个数字的期望次数.在这种状态下,如果再投一次,会出现两种可能,即出现了$i+1$个数字以及还是$i$个数字. 因此 $dp[i]=dp[i]*i/n+dp[i+1]*(n-i)/n+1$,即$dp[i]=dp[i+1]+n/(n-i)$,$dp[n]=0$,推出$dp[0]$即可. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio…
1248 - Dice (III)   PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the di…
G - Dice (III) Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that…
题意:给你n个面的骰子,问扔出所有面的期望次数. 虽然这题挺简单的但还是要提一下.这题题目给出了解法. E(m)表示得到m个不同面的期望次数. E(m+1)=[((n-m)/n)*E(m)+1]+(m/n)*E(m+1); 想必((n-m)/n)*E(m)+1这个很好理解吧,当得到m个面时他有((n-m)/n)的概率得到没得到过的面 而(m/n)*E(m+1)不太好理解为什么,其实题目已经给出解释了,如果他有(m/n)的概率出到不同 面也有1-(m/n)的概率得到相同面,所以直接加上((n-m)…