Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
139147 冯诚阳 素数检测 C++ Runtime Error 21 MS 11960 KB 511 2025-12-01 18:56:33

Tests(0/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int n=3000000; int a[3000001]={0}; int main(){ for(int i=2;i<=n;i++){ if(a[i]!=1){ for(int j=i*i;j<=n;j+=i) a[j]=1; } } for(int i=2;i<=n;i++) if(a[i]!=1) cout<<i<<" "; return 0; }


Run Info:

Runtime Error:Segmentation fault