#include<bits/stdc++.h> using namespace std; int a[100005]; int main() { int n,k; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; a[i]+=a[i-1]; } cin>>k; int begin,end; for(int i=0;i<k;i++){ cin>>begin>>end; cout<<a[end]-a[begin-1]<<endl; } return 0; }

0 comments

No comments so far...

Information

ID
2319
Time
1000ms
Memory
256MiB
Difficulty
9
Tags
# Submissions
74
Accepted
3
Uploaded By