Submission #37357


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<stdio.h>
int main()
{
int n,m,a,b;
scanf("%d",&n);
int p;
int i=0;
int total[n+1];
total[0]=0;
for( i=0; i<n; i++ ){
scanf("%d",&p);
total[i+1]=total[i]+p;
}
scanf("%d",&m);
int ans[m];
for(i=0; i < m; i++ ){
scanf("%d %d",&a,&b);
ans[i]=total[b]-total[a-1];
}
printf("0");
for( i=1; i<n+1; i++){
printf(" %d",total[i]);
}
printf("\n");
for(i=0; i < m; i++ ){
printf("%d\n",ans[i]);
}
return(0);
}

ステータス

項目 データ
問題 0733 - プログラミング入門:累積和
ユーザー名 r1804
投稿日時 2018-06-14 18:27:17
言語 C++11
状態 Accepted
得点 5
ソースコード長 606 Byte
最大実行時間 306 ms
最大メモリ使用量 69684 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 136 ms 12896 KB
1
Input02 AC 142 ms 21516 KB
1
Input03 AC 149 ms 31388 KB
1
Input04 AC 294 ms 52292 KB
1
Input05 AC 306 ms 69684 KB
1