結果

問題 No.1681 +-*
ユーザー 👑 KazunKazun
提出日時 2021-09-17 22:22:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 351 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 108,984 KB
最終ジャッジ日時 2023-09-12 08:10:24
合計ジャッジ時間 4,197 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,472 KB
testcase_01 AC 76 ms
71,248 KB
testcase_02 AC 74 ms
71,200 KB
testcase_03 AC 74 ms
71,436 KB
testcase_04 AC 73 ms
71,076 KB
testcase_05 AC 120 ms
108,796 KB
testcase_06 AC 117 ms
108,952 KB
testcase_07 AC 118 ms
108,984 KB
testcase_08 WA -
testcase_09 AC 136 ms
103,592 KB
testcase_10 AC 134 ms
103,448 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 104 ms
92,968 KB
testcase_14 AC 136 ms
103,524 KB
testcase_15 AC 77 ms
71,360 KB
testcase_16 AC 74 ms
71,312 KB
testcase_17 AC 134 ms
103,620 KB
testcase_18 AC 134 ms
103,144 KB
testcase_19 AC 132 ms
103,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#==================================================
N=int(input())
A=[-1]+list(map(int,input().split()))

Mod=10**9+7
THREE=[1]*(N+1)
for i in range(1,N+1):
    THREE[i]=(3*THREE[i-1])%Mod

X=0
alpha=1
for i in range(1,N+1):
    alpha*=A[i]; alpha%=Mod

    if i==N:
        X+=alpha
    else:
        X+=alpha*THREE[N-1-i]*2
        X%=Mod

print(X)
0