結果

問題 No.1681 +-*
ユーザー hir355hir355
提出日時 2021-09-17 21:50:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 105,784 KB
最終ジャッジ日時 2023-09-12 07:17:34
合計ジャッジ時間 4,725 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,972 KB
testcase_01 AC 69 ms
70,980 KB
testcase_02 AC 74 ms
71,216 KB
testcase_03 AC 73 ms
70,888 KB
testcase_04 AC 75 ms
70,864 KB
testcase_05 AC 199 ms
105,680 KB
testcase_06 AC 194 ms
105,784 KB
testcase_07 AC 195 ms
105,696 KB
testcase_08 AC 212 ms
100,464 KB
testcase_09 AC 211 ms
100,460 KB
testcase_10 AC 211 ms
100,356 KB
testcase_11 AC 211 ms
100,432 KB
testcase_12 AC 211 ms
100,504 KB
testcase_13 AC 134 ms
91,088 KB
testcase_14 AC 206 ms
100,428 KB
testcase_15 AC 70 ms
71,056 KB
testcase_16 AC 68 ms
71,140 KB
testcase_17 AC 208 ms
100,232 KB
testcase_18 AC 207 ms
100,344 KB
testcase_19 AC 209 ms
100,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
t = 1
ans = 0
for i in range(n):
    t *= a[i]
    t %= MOD
    if i == n - 1:
        ans += t
    else:
        ans += t * 2 * pow(3, n - i - 2, MOD)
print(ans % MOD)
0