結果

問題 No.144 エラトステネスのざる
ユーザー cielciel
提出日時 2015-02-06 04:26:16
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 132 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 56,704 KB
最終ジャッジ日時 2023-09-05 14:20:46
合計ジャッジ時間 5,061 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
19,488 KB
testcase_01 AC 84 ms
15,296 KB
testcase_02 AC 85 ms
15,268 KB
testcase_03 AC 84 ms
15,352 KB
testcase_04 AC 84 ms
15,168 KB
testcase_05 AC 84 ms
15,376 KB
testcase_06 AC 86 ms
15,056 KB
testcase_07 AC 86 ms
15,296 KB
testcase_08 AC 87 ms
15,052 KB
testcase_09 AC 86 ms
15,156 KB
testcase_10 AC 85 ms
15,160 KB
testcase_11 AC 86 ms
15,176 KB
testcase_12 AC 85 ms
15,296 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)
h=Hash.new(1)
2.upto(N.to_i){|i|(i*2).step(N.to_i,i){|j|h[j]*=1-P}}
p (2..N.to_i).map{|e|h[e]}.reduce(:+)
0