文章
61
粉丝
137
获赞
18
访问
40.0k
#include<bits/stdc++.h>
using namespace std;
bool primenumberjudge(int n);
int main(){
int n;
int judge = 0;
cin >> n;
for(int i = 2; i < n; i++){
if(i % 10 == 1){
if(primenumberjudge(i)){
cout << i << " ";
judge = 1;
}
}
}
if(judge == 0)
cout << -1;
return 0;
}
bool primenumberjudge(int n){
for(int i = 2; i <= sqrt(n); i++)
if(n % i == 0) return false;
return true;
}
登录后发布评论
暂无评论,来抢沙发