結果

問題 No.995 タピオカオイシクナーレ
ユーザー AEnAEn
提出日時 2022-11-12 00:32:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 78,292 KB
最終ジャッジ日時 2023-10-11 18:33:20
合計ジャッジ時間 5,494 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,276 KB
testcase_01 AC 72 ms
71,128 KB
testcase_02 AC 72 ms
71,176 KB
testcase_03 AC 73 ms
71,352 KB
testcase_04 AC 73 ms
71,524 KB
testcase_05 AC 73 ms
71,284 KB
testcase_06 AC 72 ms
71,336 KB
testcase_07 AC 73 ms
71,256 KB
testcase_08 AC 74 ms
71,492 KB
testcase_09 AC 74 ms
71,264 KB
testcase_10 AC 73 ms
71,276 KB
testcase_11 AC 84 ms
71,500 KB
testcase_12 AC 82 ms
71,188 KB
testcase_13 AC 85 ms
71,352 KB
testcase_14 AC 79 ms
71,308 KB
testcase_15 AC 80 ms
71,316 KB
testcase_16 AC 139 ms
78,292 KB
testcase_17 AC 140 ms
78,128 KB
testcase_18 AC 138 ms
78,192 KB
testcase_19 AC 138 ms
77,956 KB
testcase_20 AC 140 ms
78,260 KB
testcase_21 AC 140 ms
78,188 KB
testcase_22 AC 138 ms
77,960 KB
testcase_23 AC 140 ms
78,132 KB
testcase_24 AC 138 ms
78,128 KB
testcase_25 AC 140 ms
78,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K, p, q = map(int, input().split())
b = [int(input()) for _ in range(N)]
mod = 10**9+7

move = (p*pow(q,mod-2,mod))%mod
nmove = ((q-p)*pow(q,mod-2,mod))%mod
inv = pow(2,mod-2,mod)
res = 0
p = pow(nmove-move,K,mod)
for i in range(M):
    res += (b[i]*(1+p)*inv)%mod
    res %= mod
for i in range(M,N):
    res += (b[i]*(1-p)*inv)%mod
    res %= mod
print(res)
0