結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,924 KB
testcase_01 AC 16 ms
7,940 KB
testcase_02 AC 17 ms
7,916 KB
testcase_03 AC 18 ms
7,936 KB
testcase_04 AC 17 ms
7,772 KB
testcase_05 AC 507 ms
29,676 KB
testcase_06 AC 510 ms
29,736 KB
testcase_07 AC 510 ms
28,920 KB
testcase_08 AC 552 ms
30,008 KB
testcase_09 AC 552 ms
29,928 KB
testcase_10 AC 545 ms
29,860 KB
testcase_11 AC 551 ms
29,948 KB
testcase_12 AC 553 ms
29,860 KB
testcase_13 AC 250 ms
18,940 KB
testcase_14 AC 503 ms
29,976 KB
testcase_15 AC 16 ms
7,776 KB
testcase_16 AC 16 ms
7,860 KB
testcase_17 AC 522 ms
29,916 KB
testcase_18 AC 522 ms
29,948 KB
testcase_19 AC 540 ms
29,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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