結果
| 問題 | 
                            No.106 素数が嫌い!2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-03-19 14:39:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 111 ms / 5,000 ms | 
| コード長 | 316 bytes | 
| コンパイル時間 | 205 ms | 
| コンパイル使用メモリ | 82,372 KB | 
| 実行使用メモリ | 83,332 KB | 
| 最終ジャッジ日時 | 2024-07-04 23:35:58 | 
| 合計ジャッジ時間 | 1,753 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 | 
ソースコード
N, K = map(int, input().split())
if K == 1:
    print(N - 2 + 1)
    quit()
if K >= 8:
    print(0)
    quit()
    
dp = [0] * (N + 1)
for p in range(2, N + 1):
    if dp[p] > 0:
        continue
    for m in range(p, N + 1, p):
        dp[m] += 1
ans = 0
for d in dp:
    if d >= K:
        ans += 1
print(ans)