Advertisement
nicuvlad76

Untitled

Nov 19th, 2022
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <fstream>
  2. #include <bitset>
  3. #define N 500001
  4. using namespace std;
  5. ifstream fin ("eratostene1.in");
  6. ofstream fout ("eratostene1.out");
  7. bitset<N> ciur;
  8. int n,i,x,j;
  9. int ct=0;
  10. int main()
  11. {
  12. ///ciur
  13. for(int i=1;i<N;i++)
  14. if(ciur[i]==0)
  15. for(j=3*i+1;j<N;j+=(i<<1)+1)
  16. ciur[j]=1;
  17. fin>>n;
  18. while(n--)
  19. {
  20. fin>>x;
  21. if(x==2) x++;
  22. if(x%2==1)
  23. ct+=1-ciur[(x>>1)];
  24. }
  25. fout<<ct;
  26. return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement