- 4

You have been given a BIG array A containing N elements where the ith element is given by a. There are Q queries, each given by

You have been given a BIG array A containing N elements where the ith element is given by a. There are Q queries, each given by 2 integers p, q (p <9) and for each query you are required the find the sum of the array elements between indices p and q (both inclusive). Can you answer all those queries? • NOTE : P, q are zero indexed Input Format The first line will contains 2 space separated integers N and Q. The second line contains N space separated integers a for (0 <iSN-1). The next Q lines will each contain 2 space separated integers p and g. Constraints 1<N<10 isQ< 107 0<4 < 10 Output Format Output Q lines denoting the sum of the array between indices p and q. Sample Input Sample Output Explanation tat

31st May 2021, 8:11 AM
Asanka Namal
2 Réponses
+ 3
Hey Bro You can't give us homework like this first try yourself then if you face any problem then ask question
31st May 2021, 8:20 AM
Papa Penguin
0
Can we see your attempt please
31st May 2021, 9:27 AM
YUGRAJ