50pts,WA on #6-#10悬棺求调!!!
查看原帖
50pts,WA on #6-#10悬棺求调!!!
1323415
wky_wsy楼主2024/11/22 19:41
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[10007],t[10007],l,r;
signed main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        t[i]=t[i-1]+a[i];
    }
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>l>>r;
        cout<<t[r]-t[l-1]<<'\n';
    }
}
2024/11/22 19:41
加载中...