lijuncheng_1207 @ 2023-07-27 18:07:53
#include <bits/stdc++.h>
using namespace std;
int n,m,cnt;
bool prime(int x){
for(int i=2;i<=sqrt(x);i++) {
if(x%i==0)
return 0;
}
return 1;
}
bool flag(int x){
string s=to_string(x);
string s1=s;
reverse(s.begin(),s.end());
if(s1==s){
return 1;
}
return 0;
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=n;i<=m;i++) {
if(flag(i)&&prime(i)){
cout<<i<<endl;
}
}
return 0;
}
by Konjac_Jelly_6 @ 2023-07-27 18:52:04
还有因为要保证
if(n%2==0) n++;
by Konjac_Jelly_6 @ 2023-07-27 18:52:41
@Lijuncheng1207
by lijuncheng_1207 @ 2023-07-27 18:53:16
@所有人(除zbyzby666以外《我已举报》) 收帖
by aguang666 @ 2023-08-03 14:30:49
你只要比一亿小就行了,if(b>=10000000) b=9999999
by wyc0809 @ 2023-08-23 13:06:46
@zbyzby666 已举报,不谢( ̄_, ̄ )