結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 00:51:08
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 120 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 11,396 KB
実行使用メモリ 15,344 KB
最終ジャッジ日時 2023-09-05 13:43:30
合計ジャッジ時間 5,807 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,344 KB
testcase_01 AC 81 ms
15,032 KB
testcase_02 AC 80 ms
15,284 KB
testcase_03 AC 80 ms
15,064 KB
testcase_04 AC 80 ms
15,148 KB
testcase_05 AC 80 ms
15,176 KB
testcase_06 AC 82 ms
15,064 KB
testcase_07 AC 82 ms
15,140 KB
testcase_08 AC 82 ms
15,296 KB
testcase_09 AC 83 ms
15,216 KB
testcase_10 AC 81 ms
15,148 KB
testcase_11 AC 83 ms
15,252 KB
testcase_12 AC 83 ms
15,292 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)
s=0
q=1-P
(2..N).each{|i|
  s+=t=l[i]
  (i+i).step(N,i){|j|l[j]*=q}
}
p s
0