对长为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://github.com/
* @Version : $Id$
*/
#include <bits/stdc++.h>
#define LL long long
#define PII pair
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std; const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8; int main()
{
int n;
cin >> n;
while(n--)
{
double a, b;
scanf("%lf%lf", &a, &b);
if(a <= b)
printf("0.000000\n");
else printf("%.6lf\n", log(a/b) + 1); }
return 0;
}

HDU 5984 数学期望的更多相关文章

  1. Aeroplane chess HDU - 4405_数学期望_逆推

    Code: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ...

  2. UVa 12230 && HDU 3232 Crossing Rivers (数学期望水题)

    题意:你要从A到B去上班,然而这中间有n条河,距离为d.给定这n条河离A的距离p,长度L,和船的移动速度v,求从A到B的时间的数学期望. 并且假设出门前每条船的位置是随机的,如果不是在端点,方向也是不 ...

  3. HDU 4586 Play the Dice(数学期望)

    Play the Dice Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Tot ...

  4. HDU 4465 Candy (数学期望)

    题意:有两个盒子各有n个糖(n<=2*105),每天随机选1个(概率分别为p,1-p),然后吃掉一颗糖.直到有一天打开盒子一看,这个盒子没有糖了.输入n,p,求此时另一个盒子里糖的个数的数学期望 ...

  5. HDU 4405 飞行棋上的数学期望

    突然发现每次出现有关数学期望的题目都不会做,就只能找些虽然水但自己还是做不出的算数学期望的水题练练手了 题目大意: 从起点0点开始到达点n,通过每次掷色子前进,可扔出1,2,3,4,5,6这6种情况, ...

  6. HDU 5984.Pocky(2016 CCPC 青岛 C)

    Pocky Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decora ...

  7. 【整理】简单的数学期望和概率DP

    数学期望 P=Σ每一种状态*对应的概率. 因为不可能枚举完所有的状态,有时也不可能枚举完,比如抛硬币,有可能一直是正面,etc.在没有接触数学期望时看到数学期望的题可能会觉得很阔怕(因为我高中就是这么 ...

  8. 动态规划之经典数学期望和概率DP

    起因:在一场训练赛上.有这么一题没做出来. 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6829 题目大意:有三个人,他们分别有\(X,Y,Z\)块钱 ...

  9. [BZOJ 3143][HNOI2013]游走(数学期望)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=3143 分析: 易得如果知道了每条边经过的数学期望,那就可以贪心着按每条边的期望的大小赋 ...

随机推荐

  1. Centos7 Install Kubernetes

    环境搭建配置官方 k8s yum 源: cat <<EOF > /etc/yum.repos.d/virt7-docker-common-release.repo [virt7-do ...

  2. 滚动ListView时图像顺序混乱

    本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术.本文将为读者讲解滚动ListView时图像顺序混 ...

  3. docker_macvlan

    目录 macvlan macvlan macvlan的原理是在宿主机物理网卡上虚拟出多个子网卡,通过不同的MAC地址在数据链路层(Data Link Layer)进行网络数据转发的,它是比较新的网络虚 ...

  4. Haproxy Nginx cluster构建

    -----client---------haproxy-------nginx1---------nginx2------192.168.1.250 192.168.1.1 192.168.1.10 ...

  5. 关于windows下NODE_ENV=test无效的情况解决办法

    redux的单元测试命令为 NODE_ENV=test mocha --recursive --compilers js:babel-core/register --require ./test/se ...

  6. Educational Codeforces Round 46 C - Covered Points Count

    C - Covered Points Count emmm 好像是先离散化一下 注意 R需要+1 这样可以确定端点 emmm 扫描线?瞎搞一下? #include<bits/stdc++.h&g ...

  7. A1108. Finding Average

    The basic task is simple: given N real numbers, you are supposed to calculate their average. But wha ...

  8. python pip NameError:name 'pip' is not defined”

    https://www.jianshu.com/p/f57f98ebcb21 问题: 如果直接在命令行里面输入pip或者pip3,提示:(如图1) “NameError:name 'pip' is n ...

  9. django模板中使用JQ代码实现瀑布流显示效果

    settings中的配置不再详细说明 一.路由代码 from django.contrib import admin from django.conf.urls import url from app ...

  10. linux系统调用之网络管理1

    getdomainname 取域名 setdomainname 设置域名 gethostid 获取主机标识号 sethostid 设置主机标识号 gethostname 获取本主机名称 sethost ...