結果

問題 No.1681 +-*
ユーザー first_vilfirst_vil
提出日時 2021-11-18 16:59:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 547 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 26,916 KB
最終ジャッジ日時 2023-08-27 04:10:56
合計ジャッジ時間 8,466 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 AC 16 ms
7,884 KB
testcase_02 AC 18 ms
7,796 KB
testcase_03 AC 17 ms
7,728 KB
testcase_04 AC 17 ms
7,764 KB
testcase_05 AC 492 ms
25,808 KB
testcase_06 AC 504 ms
25,832 KB
testcase_07 AC 502 ms
25,852 KB
testcase_08 AC 533 ms
26,816 KB
testcase_09 AC 525 ms
26,856 KB
testcase_10 AC 533 ms
26,840 KB
testcase_11 AC 547 ms
26,860 KB
testcase_12 AC 547 ms
26,860 KB
testcase_13 AC 246 ms
17,468 KB
testcase_14 AC 496 ms
26,904 KB
testcase_15 AC 16 ms
7,792 KB
testcase_16 AC 16 ms
7,724 KB
testcase_17 AC 524 ms
26,916 KB
testcase_18 AC 509 ms
26,796 KB
testcase_19 AC 533 ms
26,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
mod = int(1e9+7)
n = int(input())
mul = 1
ans = 0
for i,a in enumerate(list(map(int,input().split()))):
	mul = (mul * a) % mod
	if i == n-1:
		ans += mul
	else:
		ans += mul * 2 * pow(3,n-2-i,mod) 
	ans %= mod
print(ans)
0