hdu_5810_Balls and Boxes(打表推公式)

题目链接:hdu_5810_Balls and Boxes

题意:

如题,让你求那个公式的期望

题解:

打表找规律,然后推公式。这项技能必须得学会

 1 #include<cstdio>
 2 #include<algorithm>
 3 using namespace std;
 4 int main()
 5 {
 6     long long n,m,g;
 7     while(~scanf("%I64d%I64d",&n,&m)&&n+m)
 8     {
 9         n=n*(m-1);
10         m=m*m;
11         g=__gcd(n,m);
12         printf("%I64d/%I64d
",n/g,m/g);
13     }
14 }
View Code
原文地址:https://www.cnblogs.com/bin-gege/p/5754222.html