結果

問題 No.1681 +-*
ユーザー O2MTO2MT
提出日時 2021-09-18 00:41:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 215 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 105,676 KB
最終ジャッジ日時 2023-09-12 11:04:16
合計ジャッジ時間 4,775 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,108 KB
testcase_01 AC 71 ms
71,116 KB
testcase_02 AC 74 ms
71,000 KB
testcase_03 AC 74 ms
71,008 KB
testcase_04 AC 73 ms
71,040 KB
testcase_05 AC 230 ms
105,156 KB
testcase_06 AC 193 ms
105,604 KB
testcase_07 AC 191 ms
105,676 KB
testcase_08 AC 206 ms
100,264 KB
testcase_09 AC 206 ms
100,180 KB
testcase_10 AC 206 ms
100,464 KB
testcase_11 AC 206 ms
100,124 KB
testcase_12 AC 208 ms
100,472 KB
testcase_13 AC 135 ms
91,260 KB
testcase_14 AC 207 ms
100,360 KB
testcase_15 AC 72 ms
71,248 KB
testcase_16 AC 71 ms
71,408 KB
testcase_17 AC 209 ms
100,376 KB
testcase_18 AC 209 ms
100,132 KB
testcase_19 AC 211 ms
100,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
ans = 0
n = 1
for i in range(N-1):
  a = A[i]
  n *= a
  n %= MOD
  ans += n*(2*pow(3,N-i-2,MOD))
  ans %= MOD

ans += n*A[-1]
ans %= MOD

print(ans)
0