HDU 5984(求木棒切割期望 数学)】的更多相关文章

题意是给定一长为 L 的木棒,每次任意切去一部分直到剩余部分的长度不超过 D,求切割次数的期望. 若木棒初始长度不超过 D,则期望是 0.000000: 设切割长度为 X 的木棒切割次数的期望是 F(X). 则 F(X) = F(切割点位置为 0 ~ D) + F(切割点位置为 D ~ X ) + 1:(此处的 +1 是指首次切割产生的次数) 而 F(切割点位置为 0 ~ D ) = 0:(因为已无需再切割) 令下一次切割点的位置为 T, F(切割点位置为 D ~ X ) = 在D~X上积分 (…
Problem Description   You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, and all…
对长为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…
Pocky Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L. While the length of remaining pocky is longer than d, we perform the following procedure. We break the pocky…
172.木棒切割问题 https://sunnywhy.com/problem/172 题目描述 给出n根木棒的长度,现在希望通过切割它们来得到至少k段长度相等的木棒(长度必须是整数),问这些长度相等的木棒的最大长度. 输入描述 第一行为两个正整数n.k(1≤n≤103.1≤k≤108),分别表示木棒的根数.需要得到的长度相等的木棒根数: 第二行为n个整数(1≤每个整数≤105),表示木棒的长度. 输出描述 一个整数,表示木棒的最大长度.如果无法达成,此时最大长度为0. 思考 如果通过暴力解法,…
Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L. While the length of remaining pocky is longer than d, we perform the following procedure. We break the pocky at an…
题意是给定一个椭圆标准方程的a,b(椭圆的长半轴长和短半轴长),在[0,b]内取一个数,则过点(0,b)且平行于x轴的直线与椭圆交于两点,再将此两点关于x轴做对称点,顺次连接此四点构成矩形,求出这些矩形周长的期望. 一开始的时候,想到所有矩形的周长和积分就是椭圆面积的两倍,但矩形的个数应该是 a + b,可是与样例不符......又尝试了矩形个数为a,b,π/2,均不对.再次读题,发现矩形的选择是在[0,b]中选的,那么矩形的个数就应该是b个. 依照题意,用积分的方法做,可得: 积分后得:a*b…
/* 坑啊 数学函数的运用log处理,exp还原 tle好长时间,一直用g++交,最后把别人正确的代码交上也是tle,用c++交一遍ac 题意:有两个数量为n的糖果,一个人开始吃,吃到最后有一堆剩余为0的时候不吃,把另一堆留给另外一个另一个人,求另一个人得到糖果的期望, 这个人吃第一堆糖果的概率是p,第二堆糖果的概率是1-p,并且当他把一堆糖果吃完,再次吃的时候发现没有了才结束. 解:分别求出当第一堆剩余的期望,第二堆剩余的期望加起来 (n-i)*C(n+i,i)*pow(p,n+1)*pow(…
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…
Play the Dice Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 3648    Accepted Submission(s): 1181Special Judge Problem Description There is a dice with n sides, which are numbered from 1,2,...,…