結果

問題 No.1681 +-*
ユーザー raven7959raven7959
提出日時 2021-09-28 07:53:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 105,548 KB
最終ジャッジ日時 2023-09-21 12:55:01
合計ジャッジ時間 7,124 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,200 KB
testcase_01 AC 68 ms
71,060 KB
testcase_02 AC 71 ms
71,384 KB
testcase_03 AC 71 ms
71,240 KB
testcase_04 AC 70 ms
71,380 KB
testcase_05 AC 271 ms
105,548 KB
testcase_06 AC 270 ms
105,536 KB
testcase_07 AC 269 ms
105,448 KB
testcase_08 AC 284 ms
100,632 KB
testcase_09 AC 287 ms
100,572 KB
testcase_10 AC 287 ms
100,468 KB
testcase_11 AC 286 ms
100,320 KB
testcase_12 AC 286 ms
100,572 KB
testcase_13 AC 173 ms
91,196 KB
testcase_14 AC 288 ms
100,216 KB
testcase_15 AC 70 ms
71,184 KB
testcase_16 AC 70 ms
71,292 KB
testcase_17 AC 288 ms
100,340 KB
testcase_18 AC 288 ms
100,524 KB
testcase_19 AC 287 ms
100,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
for i in range(N-1):
  A[i+1]=A[i]*A[i+1]%mod
ans=0
for i in range(N-1):
  ans+=A[i]*(pow(3,N-i-1,mod)-pow(3,N-i-2,mod))%mod
print((ans+A[-1])%mod)
0