結果

問題 No.1681 +-*
ユーザー shinichi
提出日時 2021-09-22 18:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 101,888 KB
最終ジャッジ日時 2024-07-05 09:19:27
合計ジャッジ時間 3,636 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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 % mod)
0