結果

問題 No.144 エラトステネスのざる
ユーザー simansiman
提出日時 2016-03-21 03:56:02
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 311 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 58,388 KB
最終ジャッジ日時 2024-04-08 21:12:19
合計ジャッジ時間 15,716 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
23,060 KB
testcase_01 AC 92 ms
16,256 KB
testcase_02 AC 89 ms
16,256 KB
testcase_03 AC 88 ms
16,256 KB
testcase_04 AC 91 ms
16,256 KB
testcase_05 AC 89 ms
16,256 KB
testcase_06 AC 90 ms
16,256 KB
testcase_07 AC 89 ms
16,256 KB
testcase_08 AC 91 ms
16,256 KB
testcase_09 AC 90 ms
16,256 KB
testcase_10 AC 90 ms
16,256 KB
testcase_11 AC 91 ms
16,256 KB
testcase_12 AC 90 ms
16,256 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    n, m = gets.chomp.split(' ').map(&:to_f)
    n = n.to_i
    list = Array.new(n+1, 1.0)
    list[0] = 0
    list[1] = 0

    2.upto(n) do |num|
      (2*num).step(n, num) do |k|
        list[k] *= (1.0 - m)
      end
    end

    puts list.inject(:+)
  end
end

Yukicoder.new
0