|One Saturday evening you are playing a game of online Scrabble. Your opponent is a very good player, but this time you managed to win. After a brief conversation, you are told: "I am clearly better than you, but one game is simply not enough to prove it." Your opponent then makess the following bet: "If we play 10 games, you will win less than 5 ... and this will happen every time, even if we try this 10 times in a row!".
You will solve a more general problem using the following parameters:
- an int trials denoting the number of meetings in which a set of games is played.
- an int games denoting the number of games that are to be played in each meeting.
- an int winsNeeded denoting the number of victories you need in one of the meetings to win the bet.
- an int winChance denoting the probability in percent of winning one particular game.
Return a double between 0 and 1, denoting the probability you have to win the bet.
|-||Your return value must have an absolute or relative error less than 1e-9.|
|-||trials will be between 1 and 50, inclusive.|
|-||games will be between 1 and 20, inclusive.|
|-||winsNeeded will be between 1 and games, inclusive.|
|-||winChance will be between 0 and 100, inclusive.|