結果

問題 No.106 素数が嫌い!2
ユーザー simansiman
提出日時 2015-01-14 04:11:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,165 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 11,452 KB
実行使用メモリ 38,196 KB
最終ジャッジ日時 2023-08-26 23:10:22
合計ジャッジ時間 10,206 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 639 ms
28,280 KB
testcase_01 AC 81 ms
15,344 KB
testcase_02 AC 82 ms
15,204 KB
testcase_03 AC 82 ms
15,216 KB
testcase_04 AC 624 ms
28,316 KB
testcase_05 AC 1,155 ms
38,056 KB
testcase_06 AC 1,165 ms
38,164 KB
testcase_07 AC 1,161 ms
38,196 KB
testcase_08 AC 146 ms
16,848 KB
testcase_09 AC 144 ms
17,072 KB
testcase_10 AC 1,141 ms
38,124 KB
testcase_11 AC 566 ms
27,332 KB
testcase_12 AC 1,161 ms
37,384 KB
testcase_13 AC 83 ms
15,436 KB
testcase_14 AC 81 ms
15,108 KB
testcase_15 AC 84 ms
15,332 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - count
Syntax OK

ソースコード

diff #

require 'prime'

class Yukicoder
  def initialize
    n, k = gets.chomp.split(' ').map(&:to_i)

    count = 0
    list = Array.new(n+1, 0)

    Prime.each(n, Prime::EratosthenesGenerator.new) do |number|
      x = 1

      while n >= number * x
        list[number * x] += 1
        x += 1
      end
    end

    puts list.count{|i| i >= k}
  end
end

Yukicoder.new
0