Problem Statement | |||||||||||||
There are n students standing in a circle and playing a game with a ball. The students are numbered from 0 to n-1 in clockwise order. On each turn, a student must take the ball and throw it at another student in the circle. Student i has a probability[i] percent chance of hitting the target student, and if he is successful, the student who is hit must leave the circle. Turns go in clockwise order, and student 0 gets the first turn. They are not allowed to skip turns. The game ends when there is only one student left in the circle.
The students are playing this game against their will, so their common goal is to finish the game in the least number of turns. Return the expected number of turns the game will last. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The returned value must be accurate to within a relative or absolute value of 1E-9. | ||||||||||||
- | Each student does not worry about how long he will stay in the circle, only the total game time matters. | ||||||||||||
Constraints | |||||||||||||
- | probability will contain between 2 and 6 elements, inclusive. | ||||||||||||
- | Each element of probability will be between 10 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|