結果

問題 No.106 素数が嫌い!2
ユーザー Zu_rinZu_rin
提出日時 2020-09-09 14:18:51
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 626 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 74,820 KB
実行使用メモリ 10,768 KB
最終ジャッジ日時 2023-08-21 16:06:41
合計ジャッジ時間 1,881 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,868 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 11 ms
6,900 KB
testcase_05 AC 23 ms
10,720 KB
testcase_06 AC 23 ms
10,684 KB
testcase_07 AC 23 ms
10,724 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 23 ms
10,768 KB
testcase_11 AC 10 ms
6,392 KB
testcase_12 AC 22 ms
10,544 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, k, i, j, ans = 0;
	cin >> num >> k;
	vector<int> d(num + 1, 0);
	for (i = 2; i <= num; i++) {
		if (!d[i]) {
			for (j = i; j <= num; j += i) {
				d[j]++;
			}
		}
		if (d[i] >= k)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}
0