Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
96047 | 只因你太美(Ikun 真爱粉) | 素数检测 | C++ | Accepted | 47 MS | 3188 KB | 556 | 2024-11-02 17:48:29 |
#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; const long long n=3000000; bool isp[n+1]={0}; int main(){ for(int i=2;i*i<=n;i++){ if(isp[i]) continue; for(int j=i*i;j<=n;j+=i){ isp[j]=1; } } for(int i=2;i<=n;i++){ if(!isp[i]) cout<<i<<" "; } return 0; }