← All problemsSign in

Periodic Sum

Given an array $A$ of size $n$. There are $q$ queries. For each query, you are given $l, r, d$. and you have to find $F(l, r, d)$, where $$F(l, r, d) = \sum_{i=0}^{(r-i*d) \geq l}A[r-i*d]$$ ###Input: - First line will contain $n$, size of the array. - Second line contain $n$ space separated integer representing $A_1, A_2...A_n$. - Third line contain $q$ representing numbur of query. T

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