D_M_S_C2310_47 @ 2023-08-30 10:57:50
#include<bits/stdc++.h>
using namespace std;
bool weishu(int n){
if((n>999&&n<10000)||(n>99999&&n<1000000))return 0;
return 1;
}
bool zhishu(int n){
if(n==2)return 1;
for(int i=2;i<=sqrt(n);i++)
if(n%i==0)return 0;
return 1;
}
bool huiwen(int n){
int a[8],tot=1;
while(n>0){
a[tot]=n%10;
n/=10,tot++;
}
for(int i=1;i<=tot/2;i++)
if(a[i]!=a[tot-i])return 0;
return 1;
}
int main(){
int l,r,i;
cin>>l>>r;
r=min(9999999,r);
if(l==2)printf("2\n");
if(l%2==0)l++;
for(i=l;i<r;i+=2){
if(huiwen(i)==0)continue;
if(zhishu(i)==0)continue;
if(weishu(i)==0)continue;
printf("%d\n",i);
}
return 0;
}
by BLuemoon_ @ 2023-08-30 11:22:28
额
by BLuemoon_ @ 2023-08-30 11:22:52
by BLuemoon_ @ 2023-08-30 11:23:13
@违规用户名js$dO^k5 暴力筛肯定会T掉啊
by D_M_S_C2310_47 @ 2023-09-01 11:26:52
@BLuemoon_ 不会
by LZQ_0626 @ 2023-09-03 21:34:10
暴力筛也可以吧