結果

問題 No.106 素数が嫌い!2
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-17 17:53:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 699 ms / 5,000 ms
コード長 318 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 10,568 KB
実行使用メモリ 39,456 KB
最終ジャッジ日時 2023-09-22 16:59:58
合計ジャッジ時間 5,811 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 325 ms
23,456 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 16 ms
7,752 KB
testcase_03 AC 15 ms
7,836 KB
testcase_04 AC 327 ms
23,660 KB
testcase_05 AC 667 ms
39,456 KB
testcase_06 AC 686 ms
39,424 KB
testcase_07 AC 694 ms
39,372 KB
testcase_08 AC 51 ms
10,172 KB
testcase_09 AC 49 ms
10,080 KB
testcase_10 AC 691 ms
39,380 KB
testcase_11 AC 266 ms
21,788 KB
testcase_12 AC 699 ms
38,088 KB
testcase_13 AC 15 ms
7,800 KB
testcase_14 AC 16 ms
7,752 KB
testcase_15 AC 16 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N, K):
    ps = [0] * (N + 1)
    for i in range(2, N + 1):
        if ps[i]:
            continue
        for j in range(i, N + 1, i):
            ps[j] += 1

    count = 0
    for pi in ps[2:]:
        if pi >= K:
            count += 1
    return count

N, K = map(int, input().split())
print(solve(N, K))
0