Mysterious Ratio
CodeChefOpen on judge ↗
Chef has been teaching probability and expectation in his class. He wants his $N$ students (numbered $1$ through $N$) to play a game so that they could understand the concepts clearly. For each valid $i$, the $i$-th student should choose an integer from a range $[L_i, R_i]$ uniformly randomly. Chef wants to know the expected value of the ratio $A/B$, where $A$ is the product of the integers cho
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start