http://codeforces.com/problemset/problem/1189/C
求一下前缀和,给定区间的数字和除以10就是答案
AC代码:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
long long seq[100050];
int main(){
long long int num;
cin>>num;
for(long long int i = 1;i<=num;i++){
long long temp;
cin>>temp;
seq[i] = temp + seq[i-1];
}
long long int q;
cin>>q;
while(q--){
long long int l,r;
cin>>l>>r;
cout<<(seq[r]-seq[l-1])/10<<endl;
}
return 0;
}