Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define pb push_back
- typedef long long ll;
- bool prime[10012];
- vector<int>pr;
- void seive()
- {
- prime[1]=true;
- pr.pb(2);
- for(int i=4; i<=10011; i+=2)
- {
- prime[i]=true;
- }
- for(int i=3; i*i<=10011; i+=2)
- {
- if(prime[i]==false)
- {
- pr.pb(i);
- for(int j=i*i; j<=10011; j+=i+i)
- {
- prime[j]=true;
- }
- }
- }
- }
- int main()
- {
- seive();
- ll n,k;
- scanf("%lld%lld",&n,&k);
- int cnt=0,res=0;
- for(int i=0;i<pr.size();i++)
- {
- //cout<<pr[i]<<" ";
- if(pr[i]<=n)
- {
- cnt=pr[i]+pr[i+1]+1;
- if(prime[cnt]==false && cnt<=n) res++;
- }
- else break;
- }
- //cout<<endl<<res<<endl;
- if(res>=k) printf("YES\n");
- else printf("NO\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement