結果

問題 No.1681 +-*
ユーザー 👑 timitimi
提出日時 2021-09-22 09:46:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 192 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 105,596 KB
最終ジャッジ日時 2023-09-18 04:58:21
合計ジャッジ時間 4,751 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,108 KB
testcase_01 AC 72 ms
71,036 KB
testcase_02 AC 73 ms
70,892 KB
testcase_03 AC 72 ms
70,836 KB
testcase_04 AC 72 ms
71,064 KB
testcase_05 AC 197 ms
105,268 KB
testcase_06 AC 194 ms
105,288 KB
testcase_07 AC 194 ms
105,596 KB
testcase_08 AC 209 ms
100,280 KB
testcase_09 AC 209 ms
100,180 KB
testcase_10 AC 209 ms
100,164 KB
testcase_11 AC 209 ms
100,284 KB
testcase_12 AC 211 ms
100,324 KB
testcase_13 AC 136 ms
91,340 KB
testcase_14 AC 210 ms
100,216 KB
testcase_15 AC 72 ms
71,052 KB
testcase_16 AC 73 ms
71,088 KB
testcase_17 AC 211 ms
100,296 KB
testcase_18 AC 210 ms
100,288 KB
testcase_19 AC 211 ms
100,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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