結果

問題 No.766 金魚すくい
ユーザー cielciel
提出日時 2018-12-16 12:38:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 611 ms / 1,500 ms
コード長 329 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 32,136 KB
最終ジャッジ日時 2023-10-25 22:10:07
合計ジャッジ時間 13,848 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
16,160 KB
testcase_01 AC 82 ms
16,160 KB
testcase_02 AC 80 ms
16,160 KB
testcase_03 AC 79 ms
16,160 KB
testcase_04 AC 80 ms
16,160 KB
testcase_05 AC 80 ms
16,160 KB
testcase_06 AC 79 ms
16,160 KB
testcase_07 AC 79 ms
16,160 KB
testcase_08 AC 80 ms
16,160 KB
testcase_09 AC 79 ms
16,160 KB
testcase_10 AC 80 ms
16,160 KB
testcase_11 AC 80 ms
16,160 KB
testcase_12 AC 79 ms
16,160 KB
testcase_13 AC 90 ms
16,420 KB
testcase_14 AC 89 ms
16,496 KB
testcase_15 AC 88 ms
16,420 KB
testcase_16 AC 88 ms
16,420 KB
testcase_17 AC 89 ms
16,436 KB
testcase_18 AC 86 ms
16,380 KB
testcase_19 AC 88 ms
16,428 KB
testcase_20 AC 88 ms
16,420 KB
testcase_21 AC 85 ms
16,216 KB
testcase_22 AC 89 ms
16,500 KB
testcase_23 AC 574 ms
32,136 KB
testcase_24 AC 385 ms
31,028 KB
testcase_25 AC 607 ms
31,384 KB
testcase_26 AC 608 ms
28,588 KB
testcase_27 AC 609 ms
31,428 KB
testcase_28 AC 580 ms
32,064 KB
testcase_29 AC 581 ms
32,064 KB
testcase_30 AC 588 ms
32,104 KB
testcase_31 AC 611 ms
31,472 KB
testcase_32 AC 586 ms
32,108 KB
testcase_33 AC 334 ms
29,964 KB
testcase_34 AC 339 ms
29,452 KB
testcase_35 AC 281 ms
19,044 KB
testcase_36 AC 272 ms
18,924 KB
testcase_37 AC 383 ms
28,008 KB
testcase_38 AC 387 ms
28,092 KB
testcase_39 AC 382 ms
29,840 KB
testcase_40 AC 378 ms
29,364 KB
testcase_41 AC 579 ms
30,692 KB
testcase_42 AC 570 ms
31,536 KB
testcase_43 AC 81 ms
16,160 KB
testcase_44 AC 80 ms
16,160 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,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