MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/array-2d/prefix_lr.cpp:12–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11using namespace std;
12int main(){
13 read(n);
14 for (int i = 1; i <=n; ++i)
15 {
16 cin>>arr[i];
17 }
18 read(t);
19 while(t--){
20 read(l);read(r);
21 ll sum=0;
22 for (int i = l; i <= r; ++i)
23 {
24 sum+=arr[i];
25 }
26 cout<<sum<<endl;
27 }
28
29 return 0;
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected