Submission #18969


ソースコード

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
#include<stdio.h>
int main(){
int n,m;
int a,b;
int unko;
scanf("%d",&n);
int data[n+1];
data[0]=0;
int i;
for(i=1;i<=n;i++){
scanf("%d",&unko);
data[i]=data[i-1]+unko;
if(i==1){
printf("0 ");
}
if(i==n){
printf("%d\n",data[i]);
break;
}
printf("%d ",data[i]);
}
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %d",&a,&b);
printf("%d\n",data[b]-data[a-1]);
}
return(0);
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 125 ms 12896 KB
1
Input02 AC 129 ms 21588 KB
1
Input03 AC 158 ms 31048 KB
1
Input04 AC 294 ms 48444 KB
1
Input05 AC 299 ms 65716 KB
1