結果
問題 | No.106 素数が嫌い!2 |
ユーザー | te-sh |
提出日時 | 2016-08-30 16:43:01 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 102,064 KB |
実行使用メモリ | 20,252 KB |
最終ジャッジ日時 | 2023-09-02 21:36:43 |
合計ジャッジ時間 | 2,163 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 1 ms
4,368 KB |
testcase_02 | AC | 1 ms
4,368 KB |
testcase_03 | WA | - |
testcase_04 | AC | 44 ms
12,148 KB |
testcase_05 | AC | 41 ms
12,064 KB |
testcase_06 | AC | 36 ms
11,812 KB |
testcase_07 | AC | 36 ms
10,552 KB |
testcase_08 | AC | 7 ms
4,368 KB |
testcase_09 | AC | 3 ms
4,372 KB |
testcase_10 | AC | 35 ms
11,288 KB |
testcase_11 | AC | 15 ms
6,792 KB |
testcase_12 | AC | 79 ms
20,252 KB |
testcase_13 | AC | 2 ms
4,368 KB |
testcase_14 | AC | 1 ms
4,372 KB |
testcase_15 | AC | 1 ms
4,376 KB |
ソースコード
import std.algorithm, std.array, std.container, std.range; import std.string, std.conv; import std.math, std.bigint, std.bitmanip, std.random; import std.stdio, std.typecons; void main() { auto rd = readln.split.map!(to!int); auto n = rd[0], k = rd[1]; auto pfi = primeFactors(n); writeln(pfi.filter!(pf => pf >= k).array.length); } int[] primeFactors(int n) { auto sieve = new int[n + 1]; auto max = max(n / 2, 2); foreach (p; 2..max + 1) if (sieve[p] == 0) foreach (q; iota(p, n + 1, p)) sieve[q] += 1; return sieve; }