結果

問題 No.106 素数が嫌い!2
ユーザー lloyzlloyz
提出日時 2023-07-05 00:06:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 272 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 107,872 KB
最終ジャッジ日時 2023-09-25 23:23:56
合計ジャッジ時間 4,400 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
92,112 KB
testcase_01 AC 70 ms
71,256 KB
testcase_02 AC 74 ms
71,320 KB
testcase_03 AC 72 ms
71,176 KB
testcase_04 AC 158 ms
92,140 KB
testcase_05 AC 256 ms
107,760 KB
testcase_06 AC 256 ms
107,872 KB
testcase_07 AC 258 ms
107,688 KB
testcase_08 AC 90 ms
78,508 KB
testcase_09 AC 92 ms
78,804 KB
testcase_10 AC 258 ms
107,540 KB
testcase_11 AC 139 ms
90,156 KB
testcase_12 AC 272 ms
106,284 KB
testcase_13 AC 73 ms
71,324 KB
testcase_14 AC 69 ms
71,520 KB
testcase_15 AC 76 ms
75,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())

IsPrime = [True for _ in range(n + 1)]
IsPrime[0] = IsPrime[1] = False
C = [0 for _ in range(n + 1)]
for i in range(2, n + 1):
    if IsPrime[i]:
        C[i] += 1
        for j in range(i + i, n + 1, i):
            C[j] += 1
            IsPrime[j] = False
ans = 0
for i in range(2, n + 1):
    if C[i] >= k:
        ans += 1
print(ans)
0