結果

問題 No.106 素数が嫌い!2
ユーザー omochana1omochana1
提出日時 2014-12-21 02:35:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 916 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 85,492 KB
実行使用メモリ 11,228 KB
最終ジャッジ日時 2023-09-02 20:35:12
合計ジャッジ時間 1,972 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,456 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 13 ms
7,264 KB
testcase_05 AC 32 ms
11,168 KB
testcase_06 AC 30 ms
11,152 KB
testcase_07 AC 32 ms
11,228 KB
testcase_08 AC 3 ms
4,372 KB
testcase_09 AC 3 ms
4,372 KB
testcase_10 AC 31 ms
11,212 KB
testcase_11 AC 12 ms
6,940 KB
testcase_12 AC 30 ms
10,896 KB
testcase_13 AC 2 ms
4,368 KB
testcase_14 AC 1 ms
4,368 KB
testcase_15 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <map>
#include <fstream>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <set>
#include <climits>
#define MAX_N 1000100
#define PI 3.141592653589
#define EPS 1e-20
#define BS 10
#define MOD 1000000009 
#define ZERO 10001
#define YJSNPI 8101919
#define INF (1 << 28)
#define ADD(a, b) a = (a + (ll)b) % MOD
#define MUL(a, b) a = (a * (ll)b) % MOD
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)


using namespace std;

typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;

int N, K;
int cnt[2000010];

int main() {
	cin >> N >> K;
	int ans = 0;
	for(int i = 2; i <= N; i++) {
		if(cnt[i] == 0) {
			for(int j = i; j <= N; j += i) {
				cnt[j]++;
			}
		}
		if(cnt[i] >= K) ans++;
	}
	cout << ans << endl;
}
0