結果

問題 No.766 金魚すくい
ユーザー cielciel
提出日時 2018-12-24 01:59:24
言語 Ruby
(3.3.0)
結果
AC  
実行時間 596 ms / 1,500 ms
コード長 332 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 11,952 KB
実行使用メモリ 32,204 KB
最終ジャッジ日時 2023-10-26 02:54:05
合計ジャッジ時間 13,816 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
16,228 KB
testcase_01 AC 80 ms
16,228 KB
testcase_02 AC 78 ms
16,228 KB
testcase_03 AC 77 ms
16,228 KB
testcase_04 AC 78 ms
16,228 KB
testcase_05 AC 77 ms
16,228 KB
testcase_06 AC 78 ms
16,228 KB
testcase_07 AC 77 ms
16,228 KB
testcase_08 AC 78 ms
16,228 KB
testcase_09 AC 78 ms
16,228 KB
testcase_10 AC 77 ms
16,228 KB
testcase_11 AC 79 ms
16,228 KB
testcase_12 AC 78 ms
16,228 KB
testcase_13 AC 85 ms
16,484 KB
testcase_14 AC 88 ms
16,564 KB
testcase_15 AC 87 ms
16,484 KB
testcase_16 AC 87 ms
16,484 KB
testcase_17 AC 87 ms
16,512 KB
testcase_18 AC 83 ms
16,448 KB
testcase_19 AC 86 ms
16,500 KB
testcase_20 AC 86 ms
16,484 KB
testcase_21 AC 84 ms
16,280 KB
testcase_22 AC 88 ms
16,556 KB
testcase_23 AC 562 ms
32,204 KB
testcase_24 AC 368 ms
31,096 KB
testcase_25 AC 594 ms
31,452 KB
testcase_26 AC 594 ms
28,656 KB
testcase_27 AC 596 ms
31,440 KB
testcase_28 AC 566 ms
32,132 KB
testcase_29 AC 566 ms
32,132 KB
testcase_30 AC 571 ms
32,172 KB
testcase_31 AC 590 ms
31,540 KB
testcase_32 AC 569 ms
32,176 KB
testcase_33 AC 322 ms
29,036 KB
testcase_34 AC 321 ms
30,052 KB
testcase_35 AC 280 ms
19,112 KB
testcase_36 AC 270 ms
18,992 KB
testcase_37 AC 368 ms
29,664 KB
testcase_38 AC 369 ms
31,096 KB
testcase_39 AC 367 ms
29,908 KB
testcase_40 AC 363 ms
28,936 KB
testcase_41 AC 574 ms
30,760 KB
testcase_42 AC 563 ms
31,476 KB
testcase_43 AC 79 ms
16,228 KB
testcase_44 AC 80 ms
16,228 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=10**9+7;I=[1,1];*F=I;*R=I;N,K,P,*V=$<.read.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,M)*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