← All problemsSign in

MOD-Queries

You are given an array A of N numbers and M queries of the form L R M and you need to output aL %M + aL+1 %M + .... + aR %M for each of these queries. Input 1 st line contains no. of test cases T. For each test case 1st line contains an integer N Next line contains N integers representing the array A. 3rd line contains M the no. of queries Next M lines contain queries of the form L R MOD

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