HDU 5236 Article 期望】的更多相关文章

题意: 你现在要打\(n\)个字符,但是程序随时可能会崩溃. 你可以在恰当的时机按下 \(Ctrl-S\)键,崩溃后,会从最后一次保存的情况继续开始打字. 具体是这样的: 在每个第\(i-0.1s(i>0)\)的时候,程序崩溃的概率为\(p\) 在每个第\(is(i \geq 0)\)的时候,你可以一口气按下\(x\)个键来存盘 在每个第\(i+0.1s(i \geq 0)\)的时候,你可以按下一个键来打字 求采取最优策略下,打完这\(n\)个字符,并且最后存盘,总按键次数的期望. 分析: 先不…
Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5236 Description As the term is going to end, DRD begins to write his final article. DRD uses the famous Macrohard's software, World, to write his article…
http://acm.hdu.edu.cn/showproblem.php?pid=5236 题意:现在有人要在文本编辑器中输入n个字符,然而这个编辑器有点问题. 在i+0.1s(i>=0)的时刻可以输入一个字符. 在i+0.9s(i>0)的时刻系统可能会崩溃,需要重新开始或者从上次保存点开始. 在i时刻可以选择保存,保存需要按x个键(假设按键速度极快).最后完成时必须保存一下. 现在要你来确定一个最佳的输入策略,使得最后按键的期望值最小. 思路:首先不考虑保存的情况: 则输入第i个字符的期望…
Article Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 863    Accepted Submission(s): 309 Problem Description As the term is going to end, DRD begins to write his final article. DRD uses the fa…
题意:要求输入一篇N个字符的文章,对所有非负整数i:每到第i+0.1秒时可以输入一个文章字符,每到第i+0.9秒时有P的概率崩溃(回到开头或者上一个存盘点) 每到第i秒有一次机会可以选择按下X个键存盘,或者不存,打印完整篇文章之后必须存盘一次才算完成输入多组N,P,X选择最佳策略使得输入完整篇文章时候按键的期望最小, 输出此期望 析:dp[i]表示打完前 i 个字符,概论是多少,dp[i] = dp[i-1] + p(1+dp[i]) + 1-p.然后解得dp[i] = (dp[i-1]+1)…
对长为L的棒子随机取一点分割两部分,抛弃左边一部分,重复过程,直到长度小于d,问操作次数的期望. 区域赛的题,比较基础的概率论,我记得教材上有道很像的题,对1/len积分,$ln(L)-ln(d)+1$. /** @Date : 2017-10-06 14:32:03 * @FileName: HDU 5984 数学期望.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://gi…
balls Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5570 Description There are n balls with m colors. The possibility of that the color of the i-th ball is color j is ai,jai,1+ai,2+...+ai,m. If the number of b…
poj 2096 题目:http://poj.org/problem?id=2096 f[ i ][ j ] 表示收集了 i 个 n 的那个. j 个 s 的那个的期望步数. #include<cstdio> #include<cstring> #include<algorithm> #define db double using namespace std; ; db n,s,f[N][N]; int main() { scanf("%lf%lf"…
Problem Description There are x cards on the desk, they are numbered from 1 to x. The score of the card which is numbered i(1<=i<=x) is i. Every round BieBie picks one card out of the x cards,then puts it back. He does the same operation for b round…
Problem Description Sakura has a very magical tool to paint walls. One day, kAc asked Sakura to paint a wall that looks like an M×N matrix. The wall has M×N squares in all. In the whole problem we denotes (x,y) to be the square at the x-th row, y-th…