Advertisement
Promi_38

cf 26A

Oct 6th, 2021
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, c = 0, ara[3001] = {0};
  8.     cin >> n;
  9.    
  10.     for(int i = 2; i <= n; i++)
  11.     {
  12.         if(ara[i] == 0)
  13.         {
  14.             for(int j = i; j <= n; j += i) ara[j]++;
  15.         }
  16.         if(ara[i] == 2) c++;
  17.     }
  18.     cout << c << endl;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement