結果

問題 No.1681 +-*
ユーザー NatsubiSogan
提出日時 2021-09-17 22:01:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 82,604 KB
実行使用メモリ 101,968 KB
最終ジャッジ日時 2024-06-29 20:30:26
合計ジャッジ時間 3,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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