結果

問題 No.1681 +-*
ユーザー SPD_9X2
提出日時 2021-09-17 21:42:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 357 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 110,436 KB
最終ジャッジ日時 2024-06-29 20:06:39
合計ジャッジ時間 4,128 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

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)

print (ans % mod)
0