結果

問題 No.106 素数が嫌い!2
ユーザー nbisconbisco
提出日時 2017-01-19 23:26:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,077 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 272,916 KB
最終ジャッジ日時 2023-08-24 17:19:18
合計ジャッジ時間 15,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 962 ms
258,636 KB
testcase_01 AC 69 ms
71,304 KB
testcase_02 AC 70 ms
71,064 KB
testcase_03 AC 70 ms
71,112 KB
testcase_04 AC 964 ms
258,652 KB
testcase_05 AC 2,027 ms
272,152 KB
testcase_06 AC 2,031 ms
272,080 KB
testcase_07 AC 2,077 ms
272,140 KB
testcase_08 AC 144 ms
88,540 KB
testcase_09 AC 150 ms
90,764 KB
testcase_10 AC 2,015 ms
272,080 KB
testcase_11 AC 847 ms
253,516 KB
testcase_12 AC 1,950 ms
272,916 KB
testcase_13 AC 71 ms
71,276 KB
testcase_14 AC 71 ms
71,248 KB
testcase_15 AC 76 ms
75,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split(" "))

primes = [2]
if N > 2:
    search = [i for i in range(3,N,2)]
    while search[0]*search[0] < N:
        primes.append(search[0])
        _search = [i for i in search[1:] if i % search[0] != 0]
        search = _search
    primes = primes + search


all_num = [0 for i in range(1,N+1)]
for i in primes:
    for j in range(i, N+1, i):
        all_num[j-1] += 1


count = 0
for i in all_num:
    if i >= K:
        count += 1

print(count)
0