結果

問題 No.1681 +-*
ユーザー lloyzlloyz
提出日時 2021-11-15 23:44:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 582 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 10,404 KB
実行使用メモリ 29,980 KB
最終ジャッジ日時 2023-08-21 18:38:29
合計ジャッジ時間 10,295 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,768 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 18 ms
7,744 KB
testcase_03 AC 17 ms
7,812 KB
testcase_04 AC 17 ms
7,840 KB
testcase_05 AC 536 ms
29,820 KB
testcase_06 AC 535 ms
29,616 KB
testcase_07 AC 535 ms
29,752 KB
testcase_08 AC 579 ms
29,924 KB
testcase_09 AC 576 ms
29,920 KB
testcase_10 AC 571 ms
29,804 KB
testcase_11 AC 582 ms
29,980 KB
testcase_12 AC 578 ms
29,804 KB
testcase_13 AC 265 ms
18,772 KB
testcase_14 AC 528 ms
29,852 KB
testcase_15 AC 16 ms
7,760 KB
testcase_16 AC 15 ms
7,832 KB
testcase_17 AC 562 ms
29,872 KB
testcase_18 AC 553 ms
29,936 KB
testcase_19 AC 574 ms
29,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

ans = 0
curr = 1
for i in range(n):
    curr *= A[i]
    curr %= mod
    if i < n - 1:
        ans += curr * 2 * pow(3, n - i - 2, mod) % mod
    else:
        ans += curr
    ans %= mod
print(ans)
0