Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114223 | 何思佳 | 素数检测 | C++ | Accepted | 61 MS | 11976 KB | 363 | 2025-03-22 11:15:27 |
#include<bits/stdc++.h> using namespace std; int shisushu[3000000]; int main() { for(int i=2; i<=3000000; i++) { if(shisushu[i]==1) { continue; } for(int j=2*i; j<=3000000; j+=i) { shisushu[j]=1; } if(i*i>3000000) { break; } } for(int i=2; i<=3000000; i++) { if(shisushu[i]==0) { cout<<i<<" "; } } return 0; }