結果

問題 No.1681 +-*
ユーザー roarisroaris
提出日時 2021-09-21 23:33:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 105,048 KB
最終ジャッジ日時 2023-09-17 13:51:03
合計ジャッジ時間 5,232 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,336 KB
testcase_01 AC 74 ms
71,572 KB
testcase_02 AC 74 ms
71,416 KB
testcase_03 AC 75 ms
71,028 KB
testcase_04 AC 73 ms
71,140 KB
testcase_05 AC 194 ms
105,044 KB
testcase_06 AC 194 ms
104,928 KB
testcase_07 AC 197 ms
105,048 KB
testcase_08 AC 209 ms
100,284 KB
testcase_09 AC 209 ms
100,188 KB
testcase_10 AC 211 ms
100,188 KB
testcase_11 AC 210 ms
100,212 KB
testcase_12 AC 207 ms
100,092 KB
testcase_13 AC 135 ms
90,480 KB
testcase_14 AC 207 ms
100,072 KB
testcase_15 AC 72 ms
71,352 KB
testcase_16 AC 73 ms
71,408 KB
testcase_17 AC 208 ms
100,060 KB
testcase_18 AC 210 ms
100,164 KB
testcase_19 AC 211 ms
100,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

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

now *= A[-1]
now %= MOD
ans += now
ans %= MOD
print(ans)
0