Given N at most 10 matches with hit probabilities and odds, find the probability that a fixed-fraction bettor ends with more money than he started.
Easy3ProbabilityBrute forceInterviewNo attempts yetTime limit1sMemory limit32 MBJeonghwan wants to practice on league matches before he bets big on the World Cup winner. He will bet on N matches, played one after another from match 1 to match N. On every match he stakes M percent of the money he holds at that moment.
For every match he has already decided whether to bet on a win, a draw or a loss, and he has worked out the hit probability Pi and the odds Ri. On match i he calls the result correctly with probability Pi percent, and a correct call pays him Ri times his stake. With the remaining 100−Pi percent he loses the whole stake. For example, if he holds 100000 won and stakes 10000 won on a match with odds 1.1, a correct call leaves him the untouched 90000 won plus 11000 won, so 101000 won.
If his money ever drops to B percent of his starting money or below, Jeonghwan stops betting on the spot and stakes nothing on the remaining matches. He stops even when the next match pays 5.0 and he calls it right 99 percent of the time.
Given the betting information, find the probability that Jeonghwan ends with more money than he started with.
The first line has the number of matches N, the share M of his money that he stakes on one match, and the threshold B at which he stops betting, separated by spaces. (1≤N≤10, 1≤M≤99, 1≤B≤99)
Each of the next N lines has the hit probability Pi and the odds Ri of match i. (1≤Pi≤99, 1.0<Ri≤5.0)
N, M, B, Pi are integers, and M, B, Pi are percentages. Ri is given with one digit after the decimal point.
Print the probability that Jeonghwan wins money, as a percentage. Ending with exactly the money he started with does not count as winning.
Round the value to six digits after the decimal point, and round up when the discarded part is exactly one half. A probability of 35 percent prints as 35.000000.