結果
| 問題 | 
                            No.106 素数が嫌い!2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kenta255
                         | 
                    
| 提出日時 | 2020-03-08 15:32:09 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,782 bytes | 
| コンパイル時間 | 1,271 ms | 
| コンパイル使用メモリ | 117,624 KB | 
| 最終ジャッジ日時 | 2025-01-09 05:52:40 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 6 WA * 7 | 
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
#include <random>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e18+7;
const ll MOD=1e9+7;
int make_p(int x,int k){
	vector<bool> isp(x+1,true);
	vector<int> cnt(x+1,0);
	int ans = 0;
	isp[0]=isp[1]=false;
	for(int i=2;i*i<=x;i++){
		if(isp[i]){
			cnt[i]++;
			for(int j=2*i;j<=x;j+=i){
				isp[j] = false;
				cnt[j]++;
			}
		}
	}
	for(int i=2;i<x+1;i++){
		ans += cnt[i] >= k;
	}
	return ans;
}
int main(){
	int N,K;
	cin >> N >> K;
	cout << make_p(N,K) << endl;
}
            
            
            
        
            
kenta255