시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB185726439.506%

문제

You are a huge fan of the RPG The Eldest Scrolls: Earthrim and know all of the game’s internal mechanics. For instance, when spawning a new monster, each of the n different types of monsters in the game has some fixed probability of appearing, and you know exactly what this probability distribution over monster types is.

However, in the latest update the developers seem to have changed the way monsters are spawned. After some testing and reverse engineering, you realise that instead of spawning all n types of monsters, each spawn location only has a spawn pool of k monster types. These spawn pools are chosen randomly at the start of the game, independently for each spawn location, with every monster type having the same chance of being chosen for the spawn pool. And apparently a developer was lazy with adjusting the spawn chances. Instead of normalising the spawn chances of the k chosen types, the developer decided that if a type of monster is not chosen, its spawn chance is added to the next chosen monster type in the list of types (and if monster types at the end of the list are not chosen, their spawn chances are added to the first chosen monster type in the list). For example, Figure G.1 shows a small example with n = 5 monsters, a possible random choice of k = 3 of those monsters, and the resulting spawn probabilities for those 3 monsters.

After the update, some monster types seem to appear less often than before, and some more often (for instance now there seem to be Gnolls all over the place). You believe that the new spawning logic may be responsible for this by having changed the effective spawn chances of the monsters. In order to test this hypothesis, you decide to compute these effective spawn chances after the update.

Figure G.1: Sample Input 1 and one possible spawn pool with adjusted spawn chances.

입력

The input consists of:

  • One line with two integers n and k (1 ≤ k ≤ n ≤ 500), the number of different types of monsters and the number of monsters that are randomly chosen for the spawn pool of each spawn location.
  • One line with n real numbers s1, s2, . . . , sn (si ≥ 0 for each i, Σsj = 100), where si is the spawn chance in percent for the ith type in the list of monster types. Every real number has at most six digits after the decimal point.

출력

Output a single line containing n real numbers, the effective spawn chance in percent of each type of monster. The ith number in your output should correspond to the ith type of monster. Your answers should have an absolute or relative error of at most 10−6.

예제 입력 1

5 3
1 25 39 12 23

예제 출력 1

8.7 17.6 31 21.4 21.3

예제 입력 2

3 2
2.019 87.51234 10.46866

예제 출력 2

4.8355533 59.01456 36.1498867

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2019 G번

  • 문제를 만든 사람: Alexander Dietsch