← All problemsSign in

Expected Product

CodeChefRating 2665Open on judge ↗

Chef is playing a tricky game with a sequence $a_1, a_2, \ldots, a_N$. Initially, his score is $S = 1$. In the game, he performs the following process exactly $K$ times (note that the sequence $a$ never changes): - Pick an element $X$ from the sequence $a$ uniformly randomly. - Change the score $S$ to $(S \cdot X) \% N$. Find the expected value of Chef's score $S$ at the end of the game. It can b

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start