Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3111 | 邓小龙 | 超级素数 | C++ | Runtime Error | 0 MS | 116 KB | 655 | 2024-04-05 16:31:01 |
#include<iostream> using namespace std; int n,st[100000001]; int ans=0; void Era(int x){ st[0]=st[1]=1; for(int i=2;i<=x/i;i++){ if(!st[i]){ for(int j=i*i;j<=x;j+=i){ st[j]=1; } } } //for(int i=1;i<=x;i++) // if(!st[i])cout<<i<<" "; } int main(){ int n; cin>>n; Era(n); for(int i=1;i<=n;i++){ if(!st[i]){ int temp=i; while(temp>0){ temp/=10; if(st[temp]==1)break; } if(temp==0)ans++; } } cout<<ans<<endl; return 0; }
Runtime Error:Segmentation fault