結果

問題 No.766 金魚すくい
ユーザー 👑 KazunKazun
提出日時 2021-02-12 02:52:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 1,500 ms
コード長 553 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 95,548 KB
最終ジャッジ日時 2023-09-25 16:23:32
合計ジャッジ時間 9,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,164 KB
testcase_01 AC 73 ms
71,300 KB
testcase_02 AC 73 ms
71,352 KB
testcase_03 AC 73 ms
71,208 KB
testcase_04 AC 72 ms
71,280 KB
testcase_05 AC 71 ms
71,252 KB
testcase_06 AC 71 ms
71,180 KB
testcase_07 AC 71 ms
71,184 KB
testcase_08 AC 71 ms
71,208 KB
testcase_09 AC 72 ms
71,140 KB
testcase_10 AC 72 ms
71,468 KB
testcase_11 AC 72 ms
71,160 KB
testcase_12 AC 72 ms
71,180 KB
testcase_13 AC 131 ms
76,476 KB
testcase_14 AC 84 ms
76,500 KB
testcase_15 AC 85 ms
76,700 KB
testcase_16 AC 85 ms
76,460 KB
testcase_17 AC 84 ms
76,424 KB
testcase_18 AC 81 ms
75,928 KB
testcase_19 AC 85 ms
76,620 KB
testcase_20 AC 84 ms
76,512 KB
testcase_21 AC 84 ms
76,532 KB
testcase_22 AC 84 ms
76,356 KB
testcase_23 AC 175 ms
95,164 KB
testcase_24 AC 166 ms
94,700 KB
testcase_25 AC 176 ms
95,548 KB
testcase_26 AC 168 ms
93,604 KB
testcase_27 AC 177 ms
95,268 KB
testcase_28 AC 169 ms
93,212 KB
testcase_29 AC 171 ms
94,824 KB
testcase_30 AC 170 ms
93,672 KB
testcase_31 AC 179 ms
95,272 KB
testcase_32 AC 172 ms
94,944 KB
testcase_33 AC 158 ms
93,312 KB
testcase_34 AC 157 ms
93,216 KB
testcase_35 AC 79 ms
77,624 KB
testcase_36 AC 79 ms
77,296 KB
testcase_37 AC 167 ms
94,900 KB
testcase_38 AC 171 ms
95,040 KB
testcase_39 AC 171 ms
94,960 KB
testcase_40 AC 164 ms
94,896 KB
testcase_41 AC 164 ms
93,556 KB
testcase_42 AC 162 ms
92,972 KB
testcase_43 AC 75 ms
71,448 KB
testcase_44 AC 74 ms
71,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def nCr(n,r):
    return (F[n]*G[r]*G[n-r])%Mod
N,M,P=map(int,input().split())
V=list(map(int,input().split()))
V.sort(reverse=True)

Mod=10**9+7
Inv_100=pow(100,Mod-2,Mod)
p=(1-P*Inv_100)%Mod

F=[1]*(N+M)
for i in range(1,N+M):
    F[i]=(F[i-1]*i)%Mod

G=[1]*(N+M)
G[-1]=pow(F[-1],Mod-2,Mod)
for i in range(N+M-2,-1,-1):
    G[i]=(G[i+1]*(i+1))%Mod

X=0
Prob=0
base=pow(1-p,M,Mod)
v=0
for k in range(N):
    s=(nCr(M+k-1,k)*pow(p,k,Mod)*base)%Mod

    Prob+=s
    Prob%=Mod

    X+=v*s
    X%=Mod

    v+=V[k]
    v%=Mod

X+=v*(1-Prob)
X%=Mod

print(X)
0