Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <bitset>
- #define N 500001
- using namespace std;
- ifstream fin ("eratostene1.in");
- ofstream fout ("eratostene1.out");
- bitset<N> ciur;
- int n,i,x,j;
- int ct=0;
- int main()
- {
- ///ciur
- for(int i=1;i<N;i++)
- if(ciur[i]==0)
- for(j=3*i+1;j<N;j+=(i<<1)+1)
- ciur[j]=1;
- fin>>n;
- while(n--)
- {
- fin>>x;
- if(x==2) x++;
- if(x%2==1)
- ct+=1-ciur[(x>>1)];
- }
- fout<<ct;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement