Submission #18163


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
int main(){
int i,n,m,t[1000001],temp[1000001],a,b,ans=0;
t[0]=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&t[i]);
ans=ans+t[i];
t[i]=ans;
}
scanf("%d",&m);
for(i=1;i<=m;i++){
scanf("%d %d",&a,&b);
temp[i]=t[b]-t[a-1];
}
for(i=1;i<=n;i++){
printf("%d ",t[i-1]);
}
printf("%d\n",t[i-1]);
for(i=1;i<=m;i++){
printf("%d\n",temp[i]);
}
return(0);
}

ステータス

項目 データ
問題 0733 - プログラミング入門:累積和
ユーザー名 ei1728
投稿日時 2017-05-29 17:16:54
言語 C
状態 Accepted
得点 5
ソースコード長 448 Byte
最大実行時間 268 ms
最大メモリ使用量 69644 KB

セット

セット 得点 Cases
1 ALL 5 / 5 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 114 ms 13536 KB
1
Input02 AC 131 ms 22380 KB
1
Input03 AC 134 ms 32872 KB
1
Input04 AC 268 ms 52316 KB
1
Input05 AC 266 ms 69644 KB
1