题目传送门 题意:n根木棍,每根木棍都有一个权值,木棍有可识别的木棍和不可识别的木棍,每次抽取木棍时,会累加权值,如果是可识别的木棍就不放回,不可识别的木棍就放回,问每根木棍至少被抽取一次,权值的期望是多少. 思路:论文题? 1类棍子只会拿起一次,ans+=权值 2类棍子会拿起多次,ans+=权值*h[n]       h[n]为调和级数第n项 证明的博客 #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) #…
题目链接 : http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27050 ------------------------------------------------------------------------------------------------------------ 我们先考虑这个问题 有一堆牌 其中$n$张牌抽到后不放回 另$m$张牌抽到后放回 求每张牌都抽到过至少一次 需要的抽牌次数的期望 对于这…
题目链接 题意: 地上有n种棍子, 其中有两种类型, 一种类型是可识别, 一种类型是不可识别, 每个棍子都有一个权值. 当你捡到可识别的, 那么你以后就不会再捡这个棍子, 如果是不可识别的, 那么你有可能还会捡. 问将所有棍子收集完的权值的期望. 思路: 此题借鉴参考了此篇文章:Aladdin and the Magical Sticks 首先, 这个题初看起来, 和LightOj 1027  A Dangerous Maze有点像, 只不过, 这里是要将所有的门都走遍. 先引入一个经典的问题:…
http://lightoj.com/volume_showproblem.php?problem=1341 Aladdin and the Flying Carpet Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1341 Description It's said that Aladdin had to solve seven…
Aladdin and the Return Journey Time Limit: 2000ms Memory Limit: 32768KB This problem will be judged on LightOJ. Original ID: 134864-bit integer IO format: %lld      Java class name: Main Finally the Great Magical Lamp was in Aladdin's hand. Now he wa…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1038 题意是:给你一个N (1 ≤ N ≤ 105) 每次N都随机选一个因子d,然后让N=N/d, 求N变成1的次数的期望: 当 N = 2 时 2有两个因子:1,2 E[2] = E[1]/2 + E[2]/2 + 1;因此可以求出E[2]; 当N = 8 时 8有4个因子1 2 4 8; E[8] = E[1]/4 + E[2]/4 + E[4]/4 + E[8]/4+ 1;因此…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1030 题意:在一个1*n 的格子里,每个格子都有相应的金币数,走到相应格子的话,就会得到该格子的金币.  现在有一个人在1这个位置,手里有一颗骰子,骰子摇到几,他就前进几步,但如果当前位置+骰子数 > n,那么他就会重新摇色子一直到<=n为止. 走到n这个位置的话,意味着游戏结束了. 问游戏结束时,这个人得到金币的期望. 设dp[i]表示从i号格子出去的期望,所以dp[i]是和i后…
http://www.lightoj.com/volume_showproblem.php?problem=1321 题意:每条边都有概率无法经过,但可以重新尝试,现给出成功率,传输次数和传输时间,求到达终点消耗时间最小的期望值的两倍. 思路:搞清楚题意后,就是个水题,暴力floyd求一下最大概率,再求下期望就好了. /** @Date : 2016-12-02-16.24 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://…
Finally the Great Magical Lamp was in Aladdin's hand. Now he wanted to return home. But he didn't want to take any help from the Genie because he thought that it might be another adventure for him. All he remembered was the paths he had taken to reac…
It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the fourth mystery. In the cave, Aladdin was moving forward after passing the pathway of magical stones. H…