AC解(试除法)
2025-08-21 18:40:17
发布于:青海
1阅读
0回复
0点赞
#include<iostream>
using namespace std;
int main(void){
int N;
cin>>N;
for(int s=2;s<=N;s++){
bool p=1;
for(int d=2;d*d<=s;d++){
if(s%d==0){
p=0;
break;
}
}if(p==1){
cout<<s<<" ";
}
}
}
这里空空如也
有帮助,赞一个