#P13669. [GCPC 2023] DnD Dice
[GCPC 2023] DnD Dice
题目描述
In Dungeons & Dragons (DnD) and many other role playing games, many actions are determined by dice rolls, and it is also quite common to use dice with different numbers of sides. The most common dice are those based on the five Platonic solids, the tetrahedron, cube, octahedron, dodecahedron and icosahedron, with , , , and sides, respectively. In DnD terminology, these dice are usually called d4, d6, d8, d12 and d20.
:::align{center} The five standard dice, Ramona Trusheim :::
As a dungeon master, you are currently designing a campaign for your group of players. In the final battle of this campaign, the players need to roll a combination of multiple dice with varying numbers of sides, and the action of the enemy is determined by the sum of the numbers on the dice that were rolled. For balancing purposes, you want to sort these sums based on how likely they are to occur, so that you can assign appropriate events to each of them.
Given the number of dice of each type, and assuming the sides of each die are numbered from to the number of sides, find all possible sums of dice rolls and output them sorted by non-increasing probability.
输入格式
The input consists of:
- One line with five integers , , , and , (), giving the number of tetrahedra, cubes, octahedra, dodecahedra and icosahedra among the dice that are rolled. There is always at least one die, that is .
输出格式
Output all possible sums, ordered from most likely to least likely. If two sums occur with the same probability, then those sums may be printed in any relative order.
1 1 1 0 0
11 10 9 12 8 13 14 7 15 6 5 16 17 4 18 3
2 0 0 1 0
9 14 12 11 10 13 15 8 16 7 6 17 5 18 4 19 3 20
0 0 0 0 1
10 3 9 8 14 13 11 7 6 12 20 4 15 5 16 1 2 19 17 18