結果

問題 No.106 素数が嫌い!2
ユーザー te-sh
提出日時 2017-01-27 17:09:54
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 104,832 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-06-12 06:40:05
合計ジャッジ時間 1,878 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], k = rd[1];

  auto sieve = new int[](n + 1);

  foreach (p; iota(2, n.to!real.sqrt.to!int + 2))
    if (sieve[p] == 0)
      foreach (q; iota(p, n + 1, p))
        ++sieve[q];

  writeln(sieve.count!(a => a >= k));
}
0