-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path26A.cpp
More file actions
54 lines (50 loc) · 740 Bytes
/
Copy path26A.cpp
File metadata and controls
54 lines (50 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<bits/stdc++.h>
using namespace std;
int n,a[3009],tot;
bool p[3009];
bool ans[90000009];
bool prime(int x){
int flag=1;
for(int i=2;i<=sqrt(x);i++){
if(x%i==0){
flag=0;
break;
}
}
return flag;
}
void sf(){
p[1]=1;
for(int i=2;i<=n;i++){
if(!prime(i)) continue;
for(int j=i+i;j<=n;j+=i){
p[j]=1;
}
}
}
int main(){
scanf("%d",&n);
sf();
for(int i=1;i<=n;i++){
if(p[i]==0){
a[++tot]=i;
}
}
for(int i=1;i<=tot;i++){
for(int j=1;j<=tot;j++){
if(i==j) continue;
for(int k1=a[i];k1<=2*n;k1*=a[i]){
for(int k2=a[j];k2<=2*n;k2*=a[j]){
if(k1*k2>n) continue;
ans[k1*k2]=1;
}
}
}
}
int anss=0;
for(int i=1;i<=n;i++){
if(ans[i]) anss++;
}
cout<<anss;
return 0;
}