Submission #60978


ソースコード

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 <bits/stdc++.h>
using namespace std;
signed main(){
int N,i,a,b;
cin>>N;
long long data[N+5]; //Ai=10の5乘の値を10の5乘分たすからめっちゃ大きくなるかも!!!!!!!
for(i=1;i<=N;i++){
cin>>data[i];
}
for(i=1;i<=N;i++){
data[i]=data[i-1]+data[i];
}
for(i=0;i<N;i++){
cout<<data[i]<<" ";
}
cout<<data[N]<<"\n";
int Q;
cin>>Q;
for(i=1;i<=Q;i++){
cin>>a>>b;
cout<<data[b]-data[a-1]<<endl;
}
return(0);
}

ステータス

項目 データ
問題 0733 - プログラミング入門:累積和
ユーザー名 ei2011
投稿日時 2020-07-16 17:00:16
言語 C++
状態 Accepted
得点 5
ソースコード長 493 Byte
最大実行時間 2398 ms
最大メモリ使用量 69732 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 194 ms 16984 KB
1
Input02 AC 210 ms 25660 KB
1
Input03 AC 422 ms 34972 KB
1
Input04 AC 2373 ms 52480 KB
1
Input05 AC 2398 ms 69732 KB
1