Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
129153 | 黄本瀚 | 求素数 | C++ | 通过 | 100 | 35 MS | 640 KB | 276 | 2024-01-26 16:28:04 |
#include<bits/stdc++.h> using namespace std; int a[110000]; int main(){ for(int i=2;i<=100000;i++){ if(!a[i]){ for(int j=2;i*j<=100000;j++){ a[i*j]=1; } } } for(int i=2;i<=100000;i++){ if(!a[i]){ cout<<i<<endl; } } return 0; }