ZOJ- 3640 Help Me Escape】的更多相关文章

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3640 题意: 有一个吸血鬼被困住了,他要逃跑... 他面前有n条路,每条路有一个困难程度c[i]. 他的初始攻击力为f. 每天他会从中随机选一条路: (1)如果当前攻击力 > c[i],那么他会再花t天走这条路成功逃跑(t的公式如图). (2)攻击力 <= c[i],这条路他走不过去,但可以让他的攻击力 += c[i]. 问你成功逃跑所需天数的期望. 题解:…
题目链接 Help Me Escape Time Limit: 2 Seconds      Memory Limit: 32768 KB Background     If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and thou shalt rule over him.  …
记忆化搜索+概率DP 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define ll __int64 #define pi acos(-1.0) #define MAX 50000 using names…
J - Help Me Escape Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3640 Description Background     If thou doest well, shalt thou not be accepted? and if tho…
Help Me Escape Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3640 Appoint description:  System Crawler  (2014-10-22) Description Background     If thou doest well, shalt thou not be accepted? an…
Background     If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and thou shalt rule over him.     And Cain talked with Abel his brother: and it came to pass, when th…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4808 题意:一个吸血鬼初始攻击力为f.n条路,他每次等概率选择一条路.如果攻击力大于这条路的c[i],则花费t[i]天逃出($t[i]=\frac{1+\sqrt{5}}{2} \times c[i]^2$),否则花费1天的时间继续选择路.问逃出去的期望天数(1<=c[i], f<=10000) #include <cstdio> #include <cm…
题目大意: 有n条路,选每条路的概率相等,初始能力值为f,每条路通过的难度值为ci,当能力值大于某条路A的难度值b时,能够成功逃离,花费时间ti,小于等于时,不能逃离,天数加一天,但能力值增加b. 给定初始的能力值,求成功逃离的期望. 分析: 概率dp做的少,感觉不是很简单. 设dp[j]表示能力值为j时,逃离的期望值. 对于每条路i,当j>c[i]时,成功逃离+(ti[i]*p),否则加(+1+dp[j+c[j]])*p; 从后往前递推,求出dp[f]. 精度卡的好严,看看下面2个代码就行了…
题意:一只吸血鬼,有n条路给他走,每次他随机走一条路,每条路有个限制,如果当时这个吸血鬼的攻击力大于等于某个值,那么就会花费t天逃出去,否则,花费1天的时间,并且攻击力增加,问他逃出去的期望 用记忆化搜索做,很好理解. #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #in…
很简单的概率题了 设dp[x]为能力值 为x时出去的期望 天数 #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> using namespace std; double dp[20005]; int ci[125]; double is=0.5*(1+sqrt(5)); int main(){ int n,f…