結果

問題 No.1681 +-*
ユーザー SPD_9X2
提出日時 2021-09-17 21:43:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 100,224 KB
最終ジャッジ日時 2024-06-29 20:07:45
合計ジャッジ時間 3,284 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

最初の掛け算の項以外は、対消滅する

"""

import sys
from sys import stdin

mod = 10**9+7

N = int(stdin.readline())

A = list(map(int,stdin.readline().split()))

ans = 0

now = 1
for i in range(N):

    now *= A[i]
    now %= mod

    if i == N-1:
        ans += now
    else:
        ans += now * 2 * pow(3,N-2-i,mod)
    ans %= mod

print (ans % mod)
0