Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
24141 | 我要进前十(黄泽远) | 【入门】筛选质数 | C++ | 通过 | 0 MS | 240 KB | 243 | 2023-07-21 14:34:45 |
#include "iostream" using namespace std; bool check(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0)return false; } return true; } int main(){ int n; cin>>n; for(int i=2;i<=n;i++){ if(check(i))cout<<i<<"\n"; } return 0; }