Submission #53864


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>
using namespace std;
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
long long ans[1000010]={};
int n,a,b,m,data;
cin>>n;
for(int i=1;i<=n;i++){
cin>>data;
ans[i]=ans[i-1]+data;
}
for(int i=0;i<n;i++) cout<<ans[i]<<" ";
cout<<ans[n]<<'\n';
cin>>m;
for(int i=1;i<=m;i++){
cin>>a>>b;
cout<<ans[b]-ans[a-1]<<'\n';
}
return(0);
}

ステータス

項目 データ
問題 0733 - プログラミング入門:累積和
ユーザー名 NASSUN_ei1906
投稿日時 2019-08-29 11:48:35
言語 C++
状態 Accepted
得点 5
ソースコード長 421 Byte
最大実行時間 406 ms
最大メモリ使用量 108312 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 150 ms 19804 KB
1
Input02 AC 148 ms 31280 KB
1
Input03 AC 160 ms 44800 KB
1
Input04 AC 406 ms 76492 KB
1
Input05 AC 392 ms 108312 KB
1