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 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
# | User | Contrib. |
---|---|---|
1 | cry | 168 |
2 | -is-this-fft- | 165 |
3 | atcoder_official | 161 |
3 | Um_nik | 161 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 147 |
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.