dd17830375846 @ 2024-05-04 01:53:23
#include<bits/stdc++.h>
using namespace std;
int judge(int i){
int a[10],l=1,q=i;
while(q/10){
a[l]=q%10;
q/=10;
l++;
}
a[l]=q;
int n;
if(l%2==0) n=l/2;
else n=(l-1)/2;
int t=1;
for(int j=1;j<=n;++j){
if(a[j]!=a[l-j+1]){
t=0;
break;
}
}
if(t){
int p=0;
for(int j=2;j<=sqrt(i);++j){
if(i%j==0) p++;
}
if(!p) return 1;
}
return 0;
}
int main(){
int a,b;
cin>>a>>b;
for(int i=a;i<=b;++i){
if(i%6==0){
if(judge(i-1)) cout<<i-1<<endl;
if(judge(i+1)) cout<<i+1<<endl;
}
}
}
by like_1999 @ 2024-05-04 18:59:14
@dd17830375846 long long