Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
37832 陈泽凯 超级素数 C++ Accepted 1 MS 268 KB 390 2022-08-25 11:59:25

Tests(10/10):


Code:

#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; }