记录编号 |
131074 |
评测结果 |
AAAAEEEEEE |
题目名称 |
求和问题 |
最终得分 |
40 |
用户昵称 |
dracul |
是否通过 |
未通过 |
代码语言 |
C++ |
运行时间 |
0.575 s |
提交时间 |
2014-10-23 20:31:35 |
内存使用 |
0.63 MiB |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int x[1000+50]={0};
int d[200000+500]={0};
int main(){
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
int a,b=0,c,e,n,m;
long long f=e;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
b++;
x[b]=a;
}
cin>>m;
f=0;
for(int p=1;p<=m;p++){
cin>>b>>c;
if(true){
f++;
for(true;b<=c;b++){
d[f]=d[f]+x[b];
}
}
}
for(int o=1;o<=m;o++){
printf("%d\n",d[o]);
}
return 0;
}