結果

問題 No.1681 +-*
ユーザー shinichi
提出日時 2021-09-22 18:39:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 102,400 KB
最終ジャッジ日時 2024-07-05 09:19:23
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9+7
ans = 0
now = 1
for i, a in enumerate(map(int, input().split())):
    now *= a
    now %= mod
    if i == N-1:
        ans += now
        continue
    ans += now * pow(3, N-i-2, mod) * 2
    ans %= mod
print(ans)
0