Advertisement
a53

D_i_v_i_z_o_r_i_3

a53
Jun 21st, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #define NN 100000
  4. using namespace std;
  5. int a,b,A,B,c,v[NN];
  6.  
  7. int main()
  8. {
  9. v[0]=v[1]=1;
  10. for(int i=2;i*i<NN; ++i)
  11. if(v[i]==0)
  12. for(int j=2;i*j<NN;++j)
  13. v[i*j]=1;
  14. cin>>a>>b;
  15. while(sqrt(a)!=(int)sqrt(a))
  16. ++a;
  17. while(sqrt(b)!=(int)sqrt(b))
  18. --b;
  19. for(int i=(int)sqrt(a);i<=(int)sqrt(b);++i)
  20. if(v[i]==0)
  21. ++c;
  22. cout<<c;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement