Submission #43444
ソースコード
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 | #include <stdio.h> int sum[1000100]; signed main(){ int n; scanf ( "%d" , &n); int i; for ( int i = 1; i <= n; i++ ) { scanf ( "%d" , &sum[i]); sum[i] += sum[i-1]; } for ( int i = 0; i <= n; i++ ) { printf ( "%d" , sum[i]); if ( i == n ) { printf ( "\n" ); } else { printf ( " " ); } } int m; scanf ( "%d" , &m); for ( int i = 0; i < m; i++ ) { int a, b; scanf ( "%d %d" , &a, &b); printf ( "%d\n" , sum[b] - sum[a-1]); } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0733 - プログラミング入門:累積和 |
ユーザー名 | r1825 |
投稿日時 | 2018-09-19 19:41:00 |
言語 | C |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 612 Byte |
最大実行時間 | 350 ms |
最大メモリ使用量 | 65612 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
Input01 | AC | 132 ms | 12896 KB |
1
|
Input02 | AC | 131 ms | 21472 KB |
1
|
Input03 | AC | 151 ms | 30936 KB |
1
|
Input04 | AC | 314 ms | 48336 KB |
1
|
Input05 | AC | 350 ms | 65612 KB |
1
|