Information
- ID
- 1924
- Time
- 2000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 42
- Accepted
- 16
- Uploaded By
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i[3000]={0},a=2;
i[1]=2,i[2]=3;
for(int c=4;c<=3000;c++){
int b=0;
for(int d=2;d*d<=c;d++){
if(c%d==0){
b=1;
break;
}
}
if(!b) i[++a]=c;
}
int n,ans=0;
cin>>n;
for(int c=2;c<=n;c++){
int k=0;
for(int d=1;d<=c;d++){
if(c%i[d]==0){
k++;
if(k>2) break;
}
if(i[d]>c/2) break;
}
if(k==2){
ans++;
}
}
cout<<ans;
}
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.