123456789101112131415161718 |
- #include<bits/stdc++.h>
- using namespace std;
- bool Primer(int n){
- if(n==2)return true;
- if(n<2||n%2==0)return false;
- for(int c=3;c*c<=n;c+=2)if(n%c==0)return false;
- return true;
- }
- int main(){
- int n;cin>>n;
- int tot=0;
- if(n>=3)++tot;
- for(int p=3;p+2<=n;p+=2){
- if(Primer(p)&&Primer(p+2))++tot;
- }
- cout<<tot<<endl;
- return 0;
- }
|