标签:+= http name problem content sum names return class
https://www.acwing.com/problem/content/797/
#include<iostream>
#define maxn 100000+10
using namespace std;
int a[maxn],s[maxn],l,r,ans;
int main()
{
int n,m;
cin>>n>>m;
s[0]=0;
for(int i=1;i<=n;i++)
{
cin>>s[i];
s[i]+=s[i-1];
}
while(m--)
{
cin>>l>>r;
ans=s[r]-s[l-1];
cout<<ans<<endl;
ans=0;
}
return 0;
}
Si=a1+a2+a3+???+ai
sum(L,R)=aL+aL+1+aL+2+???+aR=SR?SL?1
标签:+= http name problem content sum names return class
原文地址:https://www.cnblogs.com/tbdemons/p/11487405.html