Dice Cup
题目链接:
http://acm.hust.edu.cn/vjudge/contest/127406#problem/D
Description
In many table-top games it is common to use different dice to simulate random events. A “d” or “D” is used to indicate a die with a specific number of faces, d4 indicating a four-sided die, for example. If several dice of the same type are to be rolled, this is indicated by a leading number specifying the number of dice. Hence, 2d6 means the player should roll two six-sided dice and sum the result face values. Write a program to compute the most likely outcomes for the sum of two dice rolls. Assume each die has numbered faces starting at 1 and that each face has equal roll probability.Input
The input file contains several test cases, each of them as described below. The input consists of a single line with two integer numbers, N, M, specifying the number of faces of the two dice. Constraints: 4 ≤ N, M ≤ 20 Number of faces.Output
For each test case, a line with the most likely outcome for the sum; in case of several outcomes with the same probability, they must be listed from lowest to highest value in separate lines. The outputs of two consecutive cases will be separated by a blank line.Sample Input
6 6 6 4 12 20Sample Output
7 5 6 7 13 14 15 16 17 18 19 20 21##题意: 分别掷一个N面和M面的骰子. 求出现概率最大的顶面数和.
##题解: 直接模拟一遍记录所有顶面数之和. 把出现次数最多的数从小到大输出.
##代码: ``` cpp #include