hdu 5035 指数分布无后效性
http://acm.hdu.edu.cn/showproblem.php?pid=5035
n个柜台每个柜台服务的时间都满足指数分布t=p(k),求min(p(k)+t)的期望
指数分布一个有趣的特性是没有后效性,所以ci是没有用的!

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define clr0(x) memset(x,0,sizeof(x))
double t,k[1005],sum;
double c[1005];
int main()
{
int _,n,cas = 1;
RD(_);
while(_--){
RD(n);
sum = 0;
for(int i = 0;i < n;++i)
scanf("%lf",&k[i]),sum += k[i];
for(int i = 0;i < n;++i)
scanf("%lf",&c[i]);
cout<<"Case #"<<cas++<<": ";
printf("%.6f",(1+n)/sum);
cout<<endl;
}
return 0;
}
https://www.zybuluo.com/rihkddd/note/34286
hdu 5035 指数分布无后效性的更多相关文章
- HDOJ(HDU).3466 Dividing coins ( DP 01背包 无后效性的理解)
HDOJ(HDU).3466 Dividing coins ( DP 01背包 无后效性的理解) 题意分析 要先排序,在做01背包,否则不满足无后效性,为什么呢? 等我理解了再补上. 代码总览 #in ...
- hdu 5035 概率题
直接推公式的题目了.... Refer:http://blog.csdn.net/u012139398/article/details/39458623 https://www.zybuluo.com ...
- hdu 5035 概率论
n服务形式,各服务窗口等候时间指数公布,求所需的等待时间. 解: 相两点:首先,等到轮到他,然后就是送达时间. 潜伏期期望每个表单1/ki(1/ki,宣布预期指数公式).总的等待时间预期1/(求和ki ...
- poj-3666 【对dp子状态无后效性的理解】
题目链接 错解: #include <cstdio> #include <cstring> #include <algorithm> #include <io ...
- HDU 2838 (DP+树状数组维护带权排序)
Reference: http://blog.csdn.net/me4546/article/details/6333225 题目链接: http://acm.hdu.edu.cn/showprobl ...
- HDU 5293 Tree chain problem 树形dp+dfs序+树状数组+LCA
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5293 题意: 给你一些链,每条链都有自己的价值,求不相交不重合的链能够组成的最大价值. 题解: 树形 ...
- HDU 4433 locker
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4433 这是一道2012年ACM天津赛区现场赛的题目,大意是给出两串数字,求用最少的转换次数将一串(A) ...
- HDU 3466 Proud Merchants(0-1背包)
http://acm.hdu.edu.cn/showproblem.php?pid=3466 题意: 最近,iSea去了一个古老的国家.在这么长的时间里,它是世界上最富有和最强大的王国.结果,这个国家 ...
- 【hdu 3177 Crixalis's Equipment】 题解
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3177 \(describe\): 有一个山洞,山洞的容积最大为\(v\).现在你有\(n\)个物品,这 ...
随机推荐
- 更新日志(建议升级到2017.1.18a) && 更新程序的方法
更新程序的步骤: 1,在控制面板里点击备份当前数据库文件到磁盘,把当天获取的信息从内存写到磁盘/存储卡.2,下载最新版的源码 wget -O "infopi.zip" " ...
- Python内置类型性能分析
Python内置类型性能分析 timeit模块 timeit模块可以用来测试一小段Python代码的执行速度. class timeit.Timer(stmt='pass', setup='pass' ...
- mysql异常
一.Can't connect to MySQL server on 'localhost' (10061)翻译:不能连接到 localhost 上的mysql分析:这说明“localhost”计算机 ...
- JavaScript 实现双向队列并用此来测试一个单词是否为回文
题目出自<数据结构与算法 JavaScript 描述>一书第五章,习题 5.2 代码如下: /*************** Deque 类的实现 *************/ funct ...
- BLACK PHOSPHORUS: THE NEW GRAPHENE?
Materials World magazine,3 Oct 2015 Link:http://www.iom3.org/materials-world-magazine/news/2015/oct/ ...
- 120. Triangle(Array; DP)
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...
- .net调用web邮箱发送邮件(转载)
public static void SendEmail() { System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient( ...
- 一种管理z-index属性的方案
原文在这里:http://www.smashingmagazine.com/2014/06/12/sassy-z-index-management-for-complex-layouts/ 核心思想是 ...
- web 批量打印
批量打印,同时打印多个页面,有两种思路: 第一种思路,将所有的页面内容加载到一个页面中,然后再打印.这种打印方式有几个弊端,页面的样式会丢失,页面太多同时加载到一个页面中,数据量太大,响应时间很长,消 ...
- PHP-GTK的demo在windows下运行出现的问题
I am trying to use Firebird 2.5.2.26539 with wamp,When i enable the extensions of firebird in php: - ...