题解:SPOJ1026 Favorite Dice】的更多相关文章

原题链接 题目大意 给你一个n个面的骰子,每个面朝上的几率相等,问每个面都被甩到的期望次数 题解 典型的赠券收集问题. 我们考虑当你手上已有\(i\)种不同的数,从集合中任选一个数得到新数的概率,为\(\frac{n-i+1}{n}\),那期望即为\(\frac{1}{p} = \frac{n}{n-i+1}\).所以总期望为\(\sum_{i = 1}^{n}\frac{n}{n-i+1} = \sum_{i=1}^{n}\frac{n}{i}\). 当然也可以用概率dp来推: 我们设\(f[…
#include <bits/stdc++.h> using namespace std; int n,t; ; double dp[N]; /* 甩一个n面的骰子,问每一面都被甩到的需要甩的次数期望是多少. dp[i]:已经甩到i个面了,要达到n个面还需要次数的期望 显然dp[n] = 0 那么逆序分析:dp[i] :再甩一次,有(n-i)/n的概率甩到其他的 有i/n的概率甩到已经被甩过的. 那么 dp[i]=(n-i)/n*dp[i+1]+i/n*dp[i]+1(+1是因为再甩了一次)…
收录已发布的题解 按发布时间排序. 部分可能与我的其他文章有重复捏 qwq . AtCoder for Chinese: Link ZHOJ: Link 洛谷 \(1\sim 5\) : [题解]CF45I TCMCF+++ [题解]CF1013B And [题解]CF991C Candies [题解]CF356A Knight Tournament [题解]CF1715A Crossmarket \(6\sim 10\) : [题解]CF1215C Swap Letters [题解]CF172…
首先,这是一道经典的期望dp题 因为最终状态 $ (所有面都被筛到过) $ 是确定的,所以才用 逆推 ,设状态 $ f[i] $ 表示已经筛到了 $ i $ 个不同的面,有 $ i\over n $ 的概率是由$ f[i] $ 转移而来的, 也就是筛到了之前筛过的面,有 $ {n-i\over n} $ 的概率是由 $ f[i+1] $ 转移得到的, 也就是呢,筛到了一个之前没有筛到过的面,并且无论从哪里来,这次的期望次数都 比原来的期望次数多 $ 1 $,所以就得到了转移方程: $ f[i]…
BestCoder Round #7 Start Time : 2014-08-31 19:00:00    End Time : 2014-08-31 21:00:00Contest Type : Register Public   Contest Status : Ended Current Server Time : 2014-08-31 21:12:12 Solved Pro.ID Title Ratio(Accepted / Submitted)   1001 Little Pony…
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…
A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87326#problem/A Description There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up…
Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top games it is common to use different dice to simulate random events. A "d" or "D" is used to indicate a die with a specific number of fa…
A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87326#problem/A Description There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up…
Dice Notation Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3930 Description ... <Saika> I want to get some water from this strange lake. I have a bottle. <Keeper> OK. <Saika> T…