Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int fact(int n)
- {
- int p = 0;
- for(int i = 2; i*i <= n; i++)
- {
- if(n%i == 0)
- {
- p++;
- while(n%i == 0) n/=i;
- }
- }
- if(n > 1) p++;
- return p;
- }
- int main()
- {
- int n, p = 0;
- cin >> n;
- if(n < 6) cout << 0 << endl;
- else if(n >= 6 && n <= 10) cout << 2 << endl;
- else{
- for(int i = 11; i <= n; i++){
- if(fact(i) >= 2) p++;
- }
- cout << p+2 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment