hdu_5810:Balls and Boxes(期望)
这题似乎就是纯概率论。。
E(V)=D(X_i)=npq (p=1/m,p+q=1)
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; LL n,m;
LL gcd(LL a,LL b)
{
return b?gcd(b,a%b):a;
} int main()
{
while(cin>>n>>m && n+m)
{
LL a=n*m-n,b=m*m;
LL g=gcd(a,b);
cout<<a/g<<'/'<<b/g<<endl;
}
}
hdu_5810:Balls and Boxes(期望)的更多相关文章
- hdu-5810 Balls and Boxes(概率期望)
题目链接: Balls and Boxes Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- HDU 5810 Balls and Boxes(盒子与球)
Balls and Boxes(盒子与球) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- HDU 5810 Balls and Boxes (找规律)
Balls and Boxes 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5810 Description Mr. Chopsticks is i ...
- HDU5810 Balls and Boxes
Balls and Boxes Time Limi ...
- HDU 5810 Balls and Boxes 数学
Balls and Boxes 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5810 Description Mr. Chopsticks is i ...
- hdu 5810 Balls and Boxes 二项分布
Balls and Boxes Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- Codeforces Round #158 (Div. 2) C. Balls and Boxes 模拟
C. Balls and Boxes time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 260C - Balls and Boxes
260C - Balls and Boxes 思路:模拟.在x前面找到最小值,如果没有,从0跳到n,继续找到最小值,边找最小值路过的点边减1.然后所有值都减去最小值,最小值那个点加上减去的值. 找到x ...
- 2016 多校联赛7 Balls and Boxes(概率期望)
Mr. Chopsticks is interested in random phenomena, and he conducts an experiment to study randomness. ...
随机推荐
- python requests get/post
基本Get请求: #-*- coding:utf-8 -*- import requests url = 'http://www.baidu.com' r = requests.get(url) pr ...
- 【转】Delphi多线程编程
文章来源: http://liukun966123.my.gsdn.net/2004/10/22/4797/ Delphi中有一个线程类TThread是用来实现多线程编程的,这个绝大多数Delphi书 ...
- 织梦DEDECMS中的默认文件夹的名称怎么修改呢?
1.首先找到系统配置文件,一般此文件会存放在Include目录下,文件名称为:common.inc.php. 2.打开common.inc.php,以修改模板目录templets为例, ...
- Java之IO流详解
IO流 Input/Output 完成输入/输出 应用程序运行时——数据在内存中 ←→ 把数据写入硬盘(磁带) 内存中的数据不可持久保存的 输入:从外部存储器(硬盘.磁带.U盘)把数据读入内存. ...
- ionic3 环境配置 + 運行第一個項目
1.首先我們先下載個 nodejs安裝包 地址:https://nodejs.org/en/ 安裝 檢查是否安裝成功,打開命令提示符 輸入 node -v 回車 查看版本 結果: 2.安裝ionic ...
- js获取网页请求类型是http还是https
代码如下,即可判断 var ishttps = 'https:' == document.location.protocol ? true : false; if(ishttps) { alert(& ...
- 基于angularJs的单页面应用seo优化及可抓取方案原理分析
公司使用angularJs(以下都是指ng1)框架做了互联网应用,之前没接触过seo,突然一天运营那边传来任务:要给网站做搜索引擎优化,需要研发支持.搜了下发现单页面应用做seo比较费劲,国内相关实践 ...
- 2个问题,解决tomcat启动一闪而过和运行tomcat/bin目录下的startup.bat时报错(the CATALINA_HOME environment variable is not defined correctly)
1.除手动使用开始菜单自启动或者程序启动TOMCAT时TOMCAT一闪而过,这时候是发生了错误,这时候我们打开BIN目录下的“startup.bat”文件,编辑,在结尾添加pause命名,这样在CMD ...
- mac+phpstorm增加xdebug调试
一.版本信息 mac 10.10.5 phpstorm 10.0.3 xdebug 版本需要与phpstorm匹配,匹配地址 点我匹配 点我查看所有版本 提示:不确定xdebug版本的,把php ...
- linux 下载文件到本地磁盘的命令是什么
linux下可以直接运行命令下载或上传文件1.检查并安装相应的包:yum install lrzsz2.使用 sz 文件名 现在相应的文件到本地磁盘.3.上传使用rz 选择相应文件即可.