Problem: 453A - Little Pony and Expected Maximum
can not understand the solution in editorial
can anyone give me any idea of solution in deails???
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 150 |
Problem: 453A - Little Pony and Expected Maximum
can not understand the solution in editorial
can anyone give me any idea of solution in deails???
Name |
---|
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.