← All problemsSign in

Expected Value

CodeChefRating 2177Open on judge ↗

Stack has a positive integer $P(P > 1)$. He starts a game where his initial score is $0$. In the $i^{th}$ turn, with a probability of $\frac{1}{2}$, Stack adds $\frac{1}{P^{i-1}}$ to his score. Stack stops after $N$ turns. Let $S_i$ be his score after $i$ turns and $F(i)$ denote the [expected value](https://en.wikipedia.org/wiki/Expected_value) of $S_i^2$. For each integer $i(1 \leq i \le

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