結果
| 問題 | 
                            No.106 素数が嫌い!2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-01-26 06:42:35 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 21 ms / 5,000 ms | 
| コード長 | 392 bytes | 
| コンパイル時間 | 1,694 ms | 
| コンパイル使用メモリ | 165,688 KB | 
| 実行使用メモリ | 11,372 KB | 
| 最終ジャッジ日時 | 2024-09-16 04:54:22 | 
| 合計ジャッジ時間 | 2,658 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 | 
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int ans = 0;
	int a[2000001] = {};
	for (int i = 2; i <= n; i++) {
		if (!a[i]) {
			for (int j = i;  j <= n; j += i) {
				a[j]++;
			}
		}
	}
	for (int i = 2; i <= n; i++) {
		ans += a[i] >= k;
	}
	cout << ans << endl;
	return 0;
}