Advertisement
Londor13417

dead_morose

Nov 15th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool al(int n){
  4. string s="";
  5. while(n>0){
  6. s+=(char)(n%10+48);
  7. n/=10;
  8. }
  9. for(int i=1;i<s.size();i++){
  10. if(s[i-1]=='3' && s[i]=='1')
  11. return true;
  12. }
  13. return false;
  14. }
  15. bool pro(int n){
  16. if(n==1) return false;
  17. for(int i=2;i*i<=n;i++)
  18. if(n%i==0) return false;
  19. return true;
  20. }
  21. int main()
  22. {
  23. int a,b,m=0;
  24. cin>>a>>b;
  25. for(int i=a;i<=b;i++){
  26. if(al(i) || !pro(i)) continue;
  27. else
  28. m++;
  29.  
  30. }
  31. cout<<m;
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement