結果

問題 No.106 素数が嫌い!2
ユーザー code-devocode-devo
提出日時 2016-01-20 08:13:06
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,220 ms / 5,000 ms
コード長 189 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 44,400 KB
最終ジャッジ日時 2023-08-27 06:11:17
合計ジャッジ時間 11,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 723 ms
33,888 KB
testcase_01 AC 96 ms
15,332 KB
testcase_02 AC 96 ms
15,128 KB
testcase_03 AC 97 ms
15,276 KB
testcase_04 AC 688 ms
33,392 KB
testcase_05 AC 1,212 ms
37,932 KB
testcase_06 AC 1,214 ms
38,024 KB
testcase_07 AC 1,214 ms
38,080 KB
testcase_08 AC 158 ms
18,132 KB
testcase_09 AC 160 ms
17,140 KB
testcase_10 AC 1,201 ms
38,080 KB
testcase_11 AC 618 ms
27,388 KB
testcase_12 AC 1,220 ms
44,400 KB
testcase_13 AC 97 ms
15,080 KB
testcase_14 AC 95 ms
15,256 KB
testcase_15 AC 95 ms
15,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

N, K = gets.split.map(&:to_i)
A = Array.new(N + 1, 0)

Prime.each(N) do |pn|
  n = pn
  while n <= N do
    A[n] += 1
    n += pn
  end
end

puts A.select{|c| c >= K}.size
0