- 题解
2
- @ 2023-8-4 10:47:02
#include<bits/stdc++.h>
using namespace std;
long long c[100010];
int main(){
ios::sync_with_stdio(false),cin.tie(NULL);
long long n,m,a,b,cnt=0;
cin>>n;
long long t;
for(int i=1;i<=n;i++){
cin>>t;
c[i]=c[i-1]+t;
}
cin>>m;
while(m--){
cin>>a>>b;
if(a>b) swap(a,b);
cout<<(c[b]-c[a-1])<<'\n';
}
return 0;
}
0 条评论
目前还没有评论...