Solution to Dices Probability from Jobdu

11 Sep

Question (in Chinese):

Question Name: Dices Probability

Question Description: You have some customized dices. Find the three most possible sum of the dices, if you roll them.

Input: the input might contain multiple test cases. Each line, as a test case, contains two positive integers N (0 <= N <= 10) and M (6 <= M <= 8). N is the count of the dices. And M is the maximum point of the dice. So the dice’s value is [1, M], both inclusive. When get the N being 0, quit the program.

Output: print the three most possible sum of the dices, and their probability. Only consider and show the two digits after decimal point.

The solution is:

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!