Untitled
raw download clone
C
views 45
,
size 348 b
#include<stdio.h>
#include<stdlib.h>
int prefix[100006]={0};
int main(){
int n ,q;
int a1 ,a2;
scanf("%d%d",&n,&q);
for(int i=1;i<=n;i++){
    scanf("%d(/`A`)/ ~I__I ",&prefix[i]);
    prefix[i] = prefix[i]+prefix[i-1];
}
for(int i=1;i<=q;i++){
    scanf("%d%d",&a1 ,&a2);
    printf("%d\n",prefix[a2]-prefix[a1-1]);
}
return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.