結果

問題 No.1096 Range Sums
ユーザー shimariasushimariasu
提出日時 2020-06-26 22:32:46
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 23,468 KB
最終ジャッジ日時 2023-09-18 05:58:24
合計ジャッジ時間 1,916 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,748 KB
testcase_01 AC 16 ms
7,776 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 16 ms
7,732 KB
testcase_04 AC 16 ms
7,916 KB
testcase_05 AC 16 ms
7,836 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 16 ms
7,728 KB
testcase_08 AC 16 ms
7,892 KB
testcase_09 AC 16 ms
7,792 KB
testcase_10 AC 165 ms
23,468 KB
testcase_11 AC 174 ms
23,456 KB
testcase_12 AC 169 ms
23,256 KB
testcase_13 AC 166 ms
23,432 KB
testcase_14 AC 169 ms
23,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a_i = [int(x) for x in input().split()]

cumulative_sum = [0]

for i in range(n):
    cumulative_sum.append(cumulative_sum[i] + a_i[i])
    
ans = 0

for i in range(n + 1):
    ans += cumulative_sum[i] * (2 * i - n)

print(ans)
0