結果

問題 No.766 金魚すくい
ユーザー cielciel
提出日時 2018-12-16 12:09:11
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 32,188 KB
最終ジャッジ日時 2023-10-25 22:09:34
合計ジャッジ時間 16,401 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 85 ms
16,200 KB
testcase_02 AC 84 ms
16,196 KB
testcase_03 WA -
testcase_04 AC 84 ms
16,200 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 95 ms
16,256 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 395 ms
31,068 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 289 ms
19,084 KB
testcase_36 AC 278 ms
18,964 KB
testcase_37 AC 397 ms
29,636 KB
testcase_38 AC 394 ms
31,068 KB
testcase_39 AC 390 ms
29,880 KB
testcase_40 AC 387 ms
29,404 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 84 ms
16,200 KB
testcase_44 AC 83 ms
16,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=10**9+7;I=[1,1];*F=I;*R=I;N,K,P,*V=`dd`.split.map &:to_i;V.sort!
2.upto([N+K,100].max){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}
Q=(100-P)*I[100]%M
P=P*I[100]%M
r=s=0
N.times{|i|r=(r+P.pow(K,M)*Q.pow(i,K)*F[K+i-1]*R[i]*R[K-1]*s)%M;s=(s+V[N-i-1])%M}
K.times{|i|r=(r+P.pow(i,M)*Q.pow(N,M)*F[N+i-1]*R[i]*R[N-1]*s)%M}
p r
0