Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78597 杨宜炜 素数检测 C++ Time Limit Exceeded 1000 MS 264 KB 320 2024-06-22 21:06:29

Tests(0/1):


Code:

#include<bits/stdc++.h> using namespace std; int zs(int n){ if(n<2){ return 0; } if(n==2){ return 1; } if(n%2==0){ return 0; } for(int i=3;i<n;i+=2){ if(n%i==0){ return 0; } } return 1; } int main(){ for(int i=1;i<3000000;i++){ if(zs(i)==1){ cout<<i<<" "; } } }