[hihoCoder太阁最新面经算法竞赛8]B.Dice Possibility

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zz_ylolita/article/details/51923852

描述

What is possibility of rolling N dice and the sum of the numbers equals toM?

输入

Two integers N and M. (1 ≤ N ≤ 100, 1 ≤ M ≤ 600)

输出

Output the possibility in percentage with 2 decimal places.

ANS=sum / 6^N

sum=M的分解出的排列数

嗯。。。这不就是M个球装到N个盒子且每个盒子不空的方案数吗,但是每个盒子中的球不能超过6个

不定方程x1+x2+...+xN=M

1<=xi<=6,1<=i<=N

的解的个数

好吧。。二维母函数

或者递推(枚举?)

猜你喜欢

转载自blog.csdn.net/zz_ylolita/article/details/51923852