#P12940. [NERC 2019] Game Relics

    ID: 12736 Type: RemoteJudge 3000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 7 Uploaded By: Tags>2019Special JudgeICPCNERC/NEERC

[NERC 2019] Game Relics

题目描述

Esports is a form of competitive sports using video games. Dota 2 is one of the most popular competitive video games in Esports. Recently, a new video game Dota 3 was released. In Dota 3 a player can buy some relics for their hero. Relics are counters that track hero's actions and statistics in a game.

Gloria likes to play Dota 3, so she wants to buy all nn available relics for her favorite hero.

Relics can be bought using an in-game currency called shards. Each relic has its own price --- cic_i shards for the ii-th relic. A player can buy a relic using one of the following options:

  • Pay cic_i shards to buy the ii-th relic;
  • Pay xx shards and randomly get one of all nn relics. The probability of getting a relic is the same for all nn relics. If a duplicate relic is received, then the relic is recycled and x2\frac{x}{2} shards are given back to the player.

Gloria wants to buy all nn relics. Help her minimize the expected number of shards she spends to buy all the relics.

输入格式

The first line contains two integers nn and xx (1n1001 \le n \le 100; 1x100001 \le x \le 10\,000) --- the number of relics and the cost to receive a random relic.

The second line consists of nn integers c1,c2,,cnc_1, c_2, \ldots, c_n (xci10000x \le c_i \le 10\,000; ci10000\sum{c_i} \le 10\,000) --- the prices of nn relics.

输出格式

Print a single real number --- the minimum expected number of shards that Gloria must spend to buy all the relics.

The absolute or relative error should not exceed 10910^{-9}.

2 20
25 100
47.50000000000000000
4 30
60 50 60 80
171.25000000000000000

提示

In the first example, the optimal strategy is to randomly get one of the two relics paying 2020 shards. Then there are two scenarios.

The first one happens if Gloria receives the first relic. Then she keeps getting random relics until she obtains the second relic. The expected number of shards to spend in this scenario is 20+30=5020 + 30 = 50.

In the second scenario, Gloria initially gets the second relic. Then it is better to buy the first relic for 2525 shards, so the expected number of shards to spend in this scenario is 20+25=4520 + 25 = 45.

Thus, the expected number of shards to spend is 50+452=47.5\frac{50 + 45}{2} = 47.5.