lightoj 1027 简单概率dp】的更多相关文章

题目链接:http://lightoj.com/volume_showproblem.php?problem=1027 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int sum,ans,n,m; int Gcd(int a,int b){ ) return b; return Gcd(b,a%b); } int…
Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice have six faces with equal probability to face up and the numbers on the faces are 1,2,3,4,5,6). Whe…
HDU 3853    LOOPS 题目大意是说人现在在1,1,需要走到N,N,每次有p1的可能在元位置不变,p2的可能走到右边一格,有p3的可能走到下面一格,问从起点走到终点的期望值 这是弱菜做的第一道概率DP的题,首先是看了一下有关概率DP的资料,大概知道一般球概率就是从起点推到终点,求期望就是从终点推到起点 考虑这题的做法,其实很简单设DP[i][j]表示从i,j到达终点所需时间的期望值 DP[i][j] =p1 *  DP[i][j] + p2 * DP[i][j+1] + p3 * D…
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4808 题目大意: 有n条路,选每条路的概率相等,初始能力值为f,每条路通过的难度值为ci,当能力值大于某条路A的难度值b时,能够成功逃离,花费时间ti,小于等于时,不能逃离但能力值增加b. 给定初始的能力值,求成功逃离的期望. 解题思路: 简单期望dp. 设dp[i]表示能力值为i时,逃离的期望值. 对于每条路j,当i>c[j]时,成功逃离+ti[j],否则能力值…
艰难的一道题,体现出菜菜的我... 首先,先吐槽下. 这题到底出题人是怎么想的,用普通概率dp水过??? 那为什么我概率dp写的稍微烂点就一直tle?  感觉很不公平.大家算法都一致,因为我程序没有那么简练就过不了. 太坑了... 当然,说到底还是实力的问题,谁叫你不会一些常数级别的优化. 谁叫你写的时候不写的好一点. 比赛的时候在速度秒掉了最后两题后,卡这道题卡了4个多小时,也没有心情去看其他的题目了. 期间想了各种优化的方法. 最后因为一个小错误wa了N次后没有过而遗憾终身... 1. 直接…
借鉴自:https://www.cnblogs.com/keyboarder-zsq/p/6216762.html 题意:n个格子,每个格子有一个值.从1开始,每次扔6个面的骰子,扔出几点就往前几步,然后把那个格子的金子拿走: 如果扔出的骰子+所在位置>n,就重新扔,直到在n: 问取走这些值的期望值是多少 解析: [1] [2] [3][4] [5] [6] [7] [8] [9] //格子和值都是一样,所以下述的话,值就是格子,格子就是值... 比如这样的9个格子,我们总底往上来 对于第9个格…
题目链接 495. Kids and Prizes Time limit per test: 0.25 second(s)Memory limit: 262144 kilobytes input: standardoutput: standard ICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the company organiz…
You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold. Initially you are in position 1. Now each turn you throw a perfect 6 sided dice. If you get X in the dice after throwin…
Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1667    Accepted Submission(s): 1123 Problem Description Hzz loves aeroplane chess very much. The chess map contains N+1 grids lab…
C - Throwing Dice Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu LightOJ 1064 uDebug Description n common cubic dice are thrown. What is the probability that the sum of all thrown dice is at least x? Input Input starts wit…