Little Brain Teaser Expressed In Code
You are playing a game in which you roll a fair, y-sided die. if you roll x, you get x dollars (but playing the game may cost you a ticket of z dollars).
How much would you play if you were to roll only once the dice? Imagine that you are free to re-roll if not satisfied by your first attempt, but then you must accept the result of your second roll. How much would you then pay to play? What if you're allowed to reroll up to v times?