Submission #18109


ソースコード

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<iostream>
#include<cstdio>
using namespace std;
int main(){
int n,m,a,b;
scanf("%d",&n);
int data[n+1];
int p[n+1];
p[0]=0;
for(int i=0;i<n;i++){
scanf("%d",&data[i]);
}
for(int i=1;i<=n;i++){
p[i]=p[i-1]+data[i-1];
cout << p[i-1] << ' ';
} cout << p[n] << endl;
scanf("%d",&m);
for(int cas=0;cas<m;cas++){
scanf("%d %d",&a,&b);
cout << p[b]-p[a-1] << endl;
}
return 0;
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 114 ms 16860 KB
1
Input02 AC 123 ms 25532 KB
1
Input03 AC 213 ms 34976 KB
1
Input04 AC 1130 ms 52352 KB
1
Input05 AC 1117 ms 69732 KB
1