Run ID:37832

提交时间:2022-08-25 11:59:25

#include<bits/stdc++.h> using namespace std; bool sh(int x) { if(x==1) return 0; for(int i=2;i<=sqrt(x);i++) { if(x%i==0) return 0; } return 1; } int main() { int n,snm=0; cin>>n; for(int i=2;i<=n;i++) { bool l=0; int b=i; while(b){ if(!sh(b)) { l=1; break; } b/=10; } if(!l) snm++; } cout<<snm; return 0; }