HDU 4586 Play the Dice
来源:互联网 发布:程序员做笔记的软件 编辑:程序博客网 时间:2024/04/29 07:26
2013年南京邀请赛A题
由题意可知期望E=(m*E+sum)/n 则E=sum/(n-m)
值得注意的是两种特殊情况
n=m时期望无限大 输出inf
而如果sum=0时 即使n=m 结果仍然是0
#include<bits/stdc++.h>using namespace std;int main(){ int n,m,a,b; while(scanf("%d",&n)==1) { int sum=0; for(int i=1;i<=n;i++) { scanf("%d",&a); sum+=a; } scanf("%d",&m); for(int i=1;i<=m;i++) scanf("%d",&b); if(sum!=0) { if(n>m) printf("%.2lf\n",sum*1.0/(n-m)); else printf("inf\n"); } else printf("0\n"); } return 0;}
0 0
- HDU 4586 Play the Dice
- HDU 4586 Play the Dice
- hdu-Play the Dice
- (hdu 4586) Play the Dice
- hdu 4586 Play the Dice(数论)
- HDU 4586 Play the Dice 概率期望
- Play the Dice - HDU 4586 dp
- hdu 4586——Play the Dice
- HDU 4586 Play the Dice 数学期望
- Play the Dice(HDU OJ 4586)
- Play the Dice - HDU 4586 期望dp
- HDU-4586 Play the Dice (数学)
- HDU 4586 Play the dice (数学期望)
- HDU 4586 Play the Dice 简单思考
- HDU 4586:Play the Dice (数学)
- HDU-4586 Play the Dice(概率期望)
- 概率dp求期望-hdu-4586-Play the Dice
- hdu 4586 Play the Dice(水期望DP)
- POJ 2236 Wireless Network ||POJ 1703 Find them, Catch them 并查集
- nginx入门
- 在Mac下使用Gitolite来配置git服务
- 使用SqlDataAdapter时,需要注意的几点
- Codeforces Round #244 (Div. 2) E. Police Patrol
- HDU 4586 Play the Dice
- FlashBuilder4的小技巧 代码自动完成 和 代码自动提示
- Android中popWindow弹出菜单的编写
- hdu 1175 连连看
- asdf
- 二层广播(帧广播)和三层广播(路由器广播)有什么区别?
- The specified JRE installation does not exist--TomCat 错误解决
- ArrayList源码解析
- 运行startx后Ubuntu密码正确进不去的问题