結果

問題 No.1681 +-*
ユーザー irumo8202
提出日時 2022-01-27 11:00:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,976 KB
実行使用メモリ 102,016 KB
最終ジャッジ日時 2024-12-24 19:38:27
合計ジャッジ時間 3,604 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
tot = 1

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