Submission #37279
ソースコード
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 | #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int sum[1000001]; int main(){ int n, m, i; scanf ( "%d" , &n); for ( i = 1; i <= n; i++ ) { int p; scanf ( "%d" , &p); sum[i] = sum[i-1] + p; } for ( i = 0; i <= n; i++ ) { printf ( "%d" , sum[i]); if (i == n) printf ( "\n" ); else printf ( " " ); } scanf ( "%d" , &m); for ( 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-06-14 07:22:04 |
言語 | C |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 557 Byte |
最大実行時間 | 324 ms |
最大メモリ使用量 | 65596 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
Input01 | AC | 138 ms | 12896 KB |
1
|
Input02 | AC | 138 ms | 21468 KB |
1
|
Input03 | AC | 154 ms | 30928 KB |
1
|
Input04 | AC | 324 ms | 48328 KB |
1
|
Input05 | AC | 321 ms | 65596 KB |
1
|