Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #define NN 100000
- using namespace std;
- int a,b,A,B,c,v[NN];
- int main()
- {
- v[0]=v[1]=1;
- for(int i=2;i*i<NN; ++i)
- if(v[i]==0)
- for(int j=2;i*j<NN;++j)
- v[i*j]=1;
- cin>>a>>b;
- while(sqrt(a)!=(int)sqrt(a))
- ++a;
- while(sqrt(b)!=(int)sqrt(b))
- --b;
- for(int i=(int)sqrt(a);i<=(int)sqrt(b);++i)
- if(v[i]==0)
- ++c;
- cout<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement