結果

問題 No.1681 +-*
ユーザー shinichishinichi
提出日時 2021-09-22 18:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 100,544 KB
最終ジャッジ日時 2023-09-18 19:41:27
合計ジャッジ時間 4,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,332 KB
testcase_01 AC 71 ms
71,324 KB
testcase_02 AC 73 ms
71,248 KB
testcase_03 AC 72 ms
71,096 KB
testcase_04 AC 73 ms
71,448 KB
testcase_05 AC 181 ms
91,992 KB
testcase_06 AC 181 ms
91,840 KB
testcase_07 AC 181 ms
91,824 KB
testcase_08 AC 200 ms
100,296 KB
testcase_09 AC 198 ms
100,108 KB
testcase_10 AC 199 ms
100,088 KB
testcase_11 AC 198 ms
100,544 KB
testcase_12 AC 199 ms
100,220 KB
testcase_13 AC 130 ms
85,188 KB
testcase_14 AC 197 ms
100,396 KB
testcase_15 AC 72 ms
71,324 KB
testcase_16 AC 71 ms
71,208 KB
testcase_17 AC 198 ms
100,348 KB
testcase_18 AC 199 ms
100,164 KB
testcase_19 AC 199 ms
100,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9+7
ans = 0
now = 1
for i, a in enumerate(map(int, input().split())):
    now *= a
    now %= mod
    if i == N-1:
        ans += now
        continue
    ans += now * pow(3, N-i-2, mod) * 2
    ans %= mod
print(ans % mod)
0