#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;
}

1 条评论

  • @ 2023-8-4 10:28:05

    三克油歪瑞妈吃

    ❤️ 1
    • 1