結果

問題 No.995 タピオカオイシクナーレ
ユーザー 👑 KazunKazun
提出日時 2021-02-26 02:38:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 75,900 KB
最終ジャッジ日時 2024-04-09 18:41:46
合計ジャッジ時間 3,077 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,524 KB
testcase_01 AC 37 ms
52,744 KB
testcase_02 AC 37 ms
52,504 KB
testcase_03 AC 36 ms
52,224 KB
testcase_04 AC 37 ms
52,540 KB
testcase_05 AC 36 ms
51,756 KB
testcase_06 AC 37 ms
51,900 KB
testcase_07 AC 38 ms
52,272 KB
testcase_08 AC 36 ms
51,880 KB
testcase_09 AC 36 ms
53,252 KB
testcase_10 AC 37 ms
52,692 KB
testcase_11 AC 38 ms
53,812 KB
testcase_12 AC 37 ms
52,768 KB
testcase_13 AC 38 ms
52,820 KB
testcase_14 AC 37 ms
53,476 KB
testcase_15 AC 38 ms
53,360 KB
testcase_16 AC 73 ms
75,636 KB
testcase_17 AC 74 ms
75,688 KB
testcase_18 AC 73 ms
75,784 KB
testcase_19 AC 74 ms
75,656 KB
testcase_20 AC 73 ms
75,648 KB
testcase_21 AC 73 ms
75,688 KB
testcase_22 AC 73 ms
75,852 KB
testcase_23 AC 74 ms
75,532 KB
testcase_24 AC 73 ms
75,900 KB
testcase_25 AC 73 ms
75,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
N,M,K,p,q=map(int,input().split())

Mod=10**9+7
s=(p*pow(q,Mod-2,Mod))%Mod
beta=pow(1-2*s,K,Mod)

X=0
two_inv=pow(2,Mod-2,Mod)

p1=((1+beta)*two_inv)%Mod
p2=((1-beta)*two_inv)%Mod

for j in range(1,N+1):
    b=int(input())
    if j<=M:
        X+=p1*b
    else:
        X+=p2*b

print(X%Mod)
0