結果

問題 No.106 素数が嫌い!2
ユーザー nnasennnasen
提出日時 2017-12-28 04:16:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 631 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 164,496 KB
実行使用メモリ 11,160 KB
最終ジャッジ日時 2023-08-23 07:38:28
合計ジャッジ時間 3,309 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
7,504 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 12 ms
7,372 KB
testcase_05 AC 26 ms
11,100 KB
testcase_06 AC 25 ms
11,100 KB
testcase_07 AC 24 ms
11,104 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 25 ms
11,160 KB
testcase_11 AC 10 ms
7,488 KB
testcase_12 AC 29 ms
10,852 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD 1000007
#define INF 100000000
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int a[2020202];

int main() {
	int n, k;
	cin >> n >> k;
	for (LL i = 2; i <= n; ++i) {
		if (!a[i]) {
			for (LL j = i; j <= n; j += i) {
				a[j]++;
			}
		}
	}
	int ans = 0;
	for (LL i = 2; i <= n; ++i) {
		if (a[i] >= k) ans++;
	}
	cout << ans << endl;
	return 0;
}
0