← All problemsSign in

Mean Problem

You are given a sequence $a$ and its first $n$ elements. The $i$-th element of the sequence, where $i > n$ is generated by the following formula. The $i$-th element $i > n$ would be the floor of the mean of the last $n$ elements of the sequence. Formally, $$a_i = \left\lfloor \frac{\sum_{k=0}^{n-1} a_{i-n+k}}{n} \right\rfloor$$ For example, $$a_{n+1} = \left\lfloor \frac{a_1 + a_2 + \dots + a

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