結果

問題 No.1681 +-*
ユーザー irumo8202
提出日時 2022-01-27 10:55:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 287 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,184 KB
実行使用メモリ 848,568 KB
最終ジャッジ日時 2024-12-24 19:27:12
合計ジャッジ時間 20,087 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 2 MLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

accA = list(accumulate(A, lambda a, b: a * b))

ans = 0

for i in range(N - 1):
    ans += accA[i] * pow(3, N - i - 2, MOD) * 2
    ans %= MOD
ans += accA[-1]
ans %= MOD
print(ans)
0