Bobby's Bet
InterviewTime limit2sMemory limit256 MB
Decide whether a bet pays off by computing the binomial chance of rolling at least R on at least X of Y rolls and comparing it to the odds W.
- Level
Easy3 of 10
- Topics
- Probability, Combinatorics, Math
- Solved
- No attempts yet
Problem
Bobby and Betty have a bet. Betty bets that Bobby cannot roll an sided die, whose faces show through , and get a value of at least on at least of rolls. Betty owns dice with different numbers of sides , and every one of them is fair, so on a given die each face is equally likely. To watch statistically rare events while still giving Bobby a reason to play, Betty offers to odds on every round.
For example, suppose Betty bets bitcoin that Bobby cannot roll at least a on a sided die at least two times out of three, at odds of to . If Bobby does it, Betty pays him times his original bet, that is bitcoins.
Should Bobby take the bet? In other words, is his expected return greater than his original bet?
Input
The first line contains the number of test cases ().
Each of the next lines contains five integers , , , and , separated by spaces. The limits are , and .
Output
For each test case, print yes on its own line if Bobby's expected return is greater than his bet, and no otherwise.
Bobby is risk averse and does not bet when his expected return equals his bet.