結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-05 23:45:26
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 118 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 11,148 KB
実行使用メモリ 35,140 KB
最終ジャッジ日時 2023-09-05 13:01:21
合計ジャッジ時間 5,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
19,440 KB
testcase_01 AC 80 ms
15,276 KB
testcase_02 WA -
testcase_03 AC 82 ms
15,232 KB
testcase_04 AC 81 ms
15,100 KB
testcase_05 AC 81 ms
15,124 KB
testcase_06 AC 83 ms
15,024 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 87 ms
14,976 KB
testcase_12 AC 83 ms
15,220 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N,P=gets.split.map(&:to_f)
l=[0,0]+[1.0]*(N-1)
(2..N).each{|i|
  (i+i).step(N,i){|j|l[j]*=l[i]*(1-P)}
}
p l.inject(:+)
0