結果

問題 No.1681 +-*
ユーザー wolgnikwolgnik
提出日時 2021-09-17 21:33:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 105,288 KB
最終ジャッジ日時 2023-09-12 06:57:21
合計ジャッジ時間 4,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,484 KB
testcase_01 AC 74 ms
71,304 KB
testcase_02 AC 79 ms
71,492 KB
testcase_03 AC 79 ms
71,488 KB
testcase_04 AC 79 ms
71,516 KB
testcase_05 AC 201 ms
105,256 KB
testcase_06 AC 201 ms
105,044 KB
testcase_07 AC 198 ms
105,288 KB
testcase_08 AC 213 ms
100,116 KB
testcase_09 AC 215 ms
100,320 KB
testcase_10 AC 216 ms
100,208 KB
testcase_11 AC 215 ms
100,072 KB
testcase_12 AC 215 ms
100,408 KB
testcase_13 AC 141 ms
90,724 KB
testcase_14 AC 213 ms
100,248 KB
testcase_15 AC 75 ms
71,536 KB
testcase_16 AC 73 ms
71,392 KB
testcase_17 AC 209 ms
100,172 KB
testcase_18 AC 210 ms
100,188 KB
testcase_19 AC 210 ms
100,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

res = 0
cs = 1
for i in range(N):
  x = a[i]
  cs *= x
  cs %= mod
  res += cs * (2 * pow(3, max(0, N - i - 2), mod)) ** (i < N - 1)
  res %= mod
print(res)
0