結果

問題 No.1681 +-*
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-09-17 21:43:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 104,948 KB
最終ジャッジ日時 2023-09-12 07:09:06
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,920 KB
testcase_01 AC 80 ms
70,968 KB
testcase_02 AC 81 ms
71,072 KB
testcase_03 AC 80 ms
70,968 KB
testcase_04 AC 80 ms
71,048 KB
testcase_05 AC 205 ms
104,800 KB
testcase_06 AC 200 ms
104,724 KB
testcase_07 AC 198 ms
104,948 KB
testcase_08 AC 211 ms
99,956 KB
testcase_09 AC 212 ms
100,028 KB
testcase_10 AC 216 ms
99,864 KB
testcase_11 AC 216 ms
99,940 KB
testcase_12 AC 214 ms
100,080 KB
testcase_13 AC 139 ms
90,228 KB
testcase_14 AC 210 ms
99,816 KB
testcase_15 AC 75 ms
71,288 KB
testcase_16 AC 73 ms
71,188 KB
testcase_17 AC 209 ms
99,712 KB
testcase_18 AC 207 ms
99,936 KB
testcase_19 AC 209 ms
100,068 KB
権限があれば一括ダウンロードができます

ソースコード

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