样例
include[HTML_REMOVED]
using namespace std;
int a,sum[100010],n,m,l,r,i=1;
define endl ‘\n’;
int main()
{
cin>>n>>m;
while(scanf(“%d”,&a)!=EOF&&i<n)sum[i++]=sum[i-1]+a;
sum[i]=sum[i-1]+a;
while(scanf(“%d %d”,&l,&r)!=EOF)cout<<sum[r]-sum[l-1]<<endl;
}