Code: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int maxn = 100000 + 233; const double perc = (1 / 6.0); double f[maxn]; int vis[maxn]; int main() { int n,m; while(1) { memset(vis, -1, sizeof(vis));…
本题应该是可以使用实数二分的,不过笔者一直未调出来,而且发现了一种更为优美的解法,那就是逆推. 首先,不难猜到在最优解中当飞船回到 111 号节点时油量一定为 000, 这就意味着减少的油量等于减少之前的油量,即 fuel=mb1−1fuel=\frac{m}{b_{1}-1}fuel=b1​−1m​ 我们还可以将起飞和降落视为同一种操作,将公式进行变换,就得到 : fuel′=ai∗fuel+mai−1fuel'=\frac{a_{i}*fuel+m}{a_{i}-1}fuel′=ai​−1a…
对长为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…
题目链接 LOOPS Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 2630    Accepted Submission(s): 1081 Problem Description Akemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl). Homura wants to h…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4405 Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz s…
http://acm.split.hdu.edu.cn/showproblem.php?pid=4405 Aeroplane chess Problem Description   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…
Aeroplane chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2060    Accepted Submission(s): 1346 Problem Description Hzz loves aeroplane chess very much. The chess map contains N+1 grids lab…
数学期望 P=Σ每一种状态*对应的概率. 因为不可能枚举完所有的状态,有时也不可能枚举完,比如抛硬币,有可能一直是正面,etc.在没有接触数学期望时看到数学期望的题可能会觉得很阔怕(因为我高中就是这么认为的,对不起何老板了QwQ),避之不及. 但是现在发现大多数题就是手动找公式或者DP推出即可,只要处理好边界,然后写好方程,代码超级简短.与常规的求解不同,数学期望经常逆向推出. 比如常规的dp[x]可能表示到了x这一状态有多少,最后答案是dp[n].而数学期望的dp[x]一般表示到了x这一状态还…
In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them meet. Nothing will happen if they are of the same species, that is, a people meets a people or a bloodsucker meets a bloodsucker. Otherwise, people may be transfo…
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…