比赛 | 板子大赛 | 评测结果 | AAAAAAAAAA |
---|---|---|---|
题目名称 | 求和问题 | 最终得分 | 100 |
用户昵称 | 李金泽 | 运行时间 | 0.433 s |
代码语言 | C++ | 内存使用 | 1.61 MiB |
提交时间 | 2025-01-22 09:10:40 | ||
#include<cstdio> #define N 10005 #define ll long long int n,m,x,y;ll a[N]; int main() { freopen("sum.in","r",stdin);freopen("sum.out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%lld",a+i),a[i]+=a[i-1]; scanf("%d",&m); while(m--) { scanf("%d%d",&x,&y); printf("%lld\n",a[y]-a[x-1]); } return 0; }