結果

問題 No.1681 +-*
ユーザー Mik10
提出日時 2021-10-07 20:58:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 268 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 82,960 KB
実行使用メモリ 265,788 KB
最終ジャッジ日時 2024-07-23 03:07:47
合計ジャッジ時間 4,873 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
seql = list(map(int, input().split()))
import operator, itertools

n -= 2
ans = 0
for p in itertools.accumulate(seql, func=operator.mul):
    if not p:
        break
    ans += pow(3, n, 10**9+7) * 2*p if n >= 0 else p
    n -= 1
print (ans%(10**9+7))
0