結果

問題 No.1681 +-*
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-09-17 22:01:52
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 106,016 KB
最終ジャッジ日時 2023-09-12 07:34:41
合計ジャッジ時間 4,674 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,536 KB
testcase_01 AC 76 ms
71,308 KB
testcase_02 AC 73 ms
71,380 KB
testcase_03 AC 74 ms
71,404 KB
testcase_04 AC 73 ms
71,160 KB
testcase_05 AC 194 ms
106,008 KB
testcase_06 AC 194 ms
105,684 KB
testcase_07 AC 194 ms
106,016 KB
testcase_08 AC 211 ms
100,716 KB
testcase_09 AC 209 ms
100,324 KB
testcase_10 AC 209 ms
100,648 KB
testcase_11 AC 210 ms
100,440 KB
testcase_12 AC 209 ms
100,700 KB
testcase_13 AC 137 ms
91,612 KB
testcase_14 AC 211 ms
100,532 KB
testcase_15 AC 72 ms
71,404 KB
testcase_16 AC 73 ms
71,444 KB
testcase_17 AC 213 ms
100,320 KB
testcase_18 AC 211 ms
100,552 KB
testcase_19 AC 208 ms
100,604 KB
権限があれば一括ダウンロードができます

ソースコード

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