Problem: 453A - Little Pony and Expected Maximum
can not understand the solution in editorial
can anyone give me any idea of solution in deails???
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Problem: 453A - Little Pony and Expected Maximum
can not understand the solution in editorial
can anyone give me any idea of solution in deails???
Название |
---|
Expected values are calculated as follows E[X] = sum(x*p(x)) where X is a random variable and 'x' are all possible outcomes
Lets define a random variable X to be the maximum of n tosses of m-sided dice. 'x' are all possible maximums that can happen (1,2,3,..,m) and p(x) is the probability that x is the maximum.
Tricky thing here is to calculate p(x) for each x. You have to use the formula for combinations with repetition: If you toss the m-sided dice n times, there are m^n possible outcomes.
For a maximum 'x' you can use formula p(x) = (x^n — (x-1)^n) / m^n
Let me elaborate this. We count all the outcomes where you never toss a dice higher than x (there are x^n of them). That means that for these outcomes the maximum will be <=x. From that we have to subtract the outcomes where you toss only numbers less than x (there are (x-1)^n of them). Now you have the number of outcomes where maximum is x. You divide that by m^n (number of total outcomes that can happen) and you have yourself the probability that after n tosses, you will get maximum x.