結果

問題 No.1681 +-*
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-13 01:40:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 105,692 KB
最終ジャッジ日時 2023-08-20 04:04:29
合計ジャッジ時間 4,864 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,404 KB
testcase_01 AC 72 ms
71,444 KB
testcase_02 AC 74 ms
71,200 KB
testcase_03 AC 73 ms
71,128 KB
testcase_04 AC 75 ms
71,232 KB
testcase_05 AC 192 ms
105,444 KB
testcase_06 AC 191 ms
105,612 KB
testcase_07 AC 195 ms
105,692 KB
testcase_08 AC 210 ms
100,368 KB
testcase_09 AC 211 ms
100,408 KB
testcase_10 AC 209 ms
100,368 KB
testcase_11 AC 209 ms
100,396 KB
testcase_12 AC 209 ms
100,604 KB
testcase_13 AC 136 ms
91,396 KB
testcase_14 AC 209 ms
100,336 KB
testcase_15 AC 73 ms
71,224 KB
testcase_16 AC 74 ms
71,224 KB
testcase_17 AC 210 ms
100,412 KB
testcase_18 AC 207 ms
100,592 KB
testcase_19 AC 209 ms
100,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(ans)
0