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;
    }
}
原文地址:https://www.cnblogs.com/Just--Do--It/p/6405806.html