HDU 5810 Balls and Boxes
n*(m-1)/(m*m)
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
inline int read()
{
char c = getchar(); while(!isdigit(c)) c = getchar(); int x = ;
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
return x;
} LL n,m;
LL gcd(LL a,LL b){ if(b==)return a; return gcd(b,a%b); } int main()
{
while(~scanf("%lld%lld",&n,&m))
{
if(n==&&m==) break;
LL x1=n*(m-),x2=m*m ;
LL GCD=gcd(x1,x2);
if(x1==) printf("0/1\n");
else printf("%lld/%lld\n",x1/GCD,x2/GCD);
}
return ;
}
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 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5810 Description Mr. Chopsticks is i ...
- 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 ...
- HDU 5810 Balls and Boxes ——(数学,概率,方差)
官方题解看不太懂,参考了一些人的博客以后自己证明如下: 其中D(X)和E(X)的公式如下(参考自百度百科): 其中 p = 1 / m .(这是每一个单独事件发生的概率期望,在这里单独事件指的是一个球 ...
- hdu 5810:Balls and Boxes(期望)
题目链接 这题似乎就是纯概率论.. E(V)=D(X_i)=npq (p=1/m,p+q=1) #include<bits/stdc++.h> using namespace std; 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 ...
- HDU5810 Balls and Boxes
Balls and Boxes Time Limi ...
- Codeforces 260C - Balls and Boxes
260C - Balls and Boxes 思路:模拟.在x前面找到最小值,如果没有,从0跳到n,继续找到最小值,边找最小值路过的点边减1.然后所有值都减去最小值,最小值那个点加上减去的值. 找到x ...
随机推荐
- 【转】Jmeter(二)-使用代理录制脚本
Jmeter脚本是以JMX格式为主 Jmeter也是支持录制的,支持第三方录制方式和代理录制方式. 1.第三方录制主要是通过badboy来录制,录制后另存为jmx格式即可. 2.Jmeter也有自己的 ...
- 常用Git命令大全
Git命令 查看.添加.提交.删除.找回,重置修改文件 git help <command> # 显示command的help git show # 显示某次提交的内容 git show ...
- iis无法加载样式
- WSAEventSelect IO复用模型
1 今天帮一学习WSAEventSelect的网友排查一个测试用服务器端recv返回0的问题,出现这个问题直观判断一般是客户端socket关闭了,可是他的代码很简单并且是本机测试,通过wireshar ...
- Android 使用URLConnection来post数据
/** * @param postUrl * 需要post的地址 * @param map * 存储数据的map * @param handler * 处理message的handler */ pub ...
- 分布式版本控制系统Git-----2.上传至远程仓库之基础版
好,之前已经将文档下载下来了,但是我感觉还是将自己之前截的图放出来比较好,自己整理的,但是总不能放桌面上,时间久了也会忘得,索性放到博客上吧,也便于其他人查看,简直是百利而无一害啊.哈哈.来吧. 注意 ...
- ios UISearchBar搜索框的基本使用
摘要: 小巧简洁的原生搜索框,漂亮而易用,如果我们的应用没有特殊需求,都可以使用它. iOS中UISearchBar(搜索框)使用总结 初始化:UISearchBar继承于UIView,我们可以像创建 ...
- [妙味JS基础]第二课:for应用、this关键字
知识点总结 getElementsByTagName(动态方法) 与 getElementById(静态方法) 的区别 1.ID前面只能跟document,不能跟其他元素,比如:document.ge ...
- iOS开发瀑布流的实现
//自定义布局,继承于UICollectionViewLayout #import <UIKit/UIKit.h> @class WaterFlowLayout; @protocol W ...
- 明天学习一下验证码的匹配和thinkphp第十三章
333333333 js 冒泡排序 var arr=[17,19,5,90,3];window.onload=function(){// alert(arr[0]);var len=arr.lengt ...