- 捕风捉影
- 2015-08-10 15:01:29 @
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int v[11000000];
int lulalalulalalulalulahei(int x)
{
int i=0;
if(v[x]==-1)
{
int t=int (sqrt(double(x+1)));
for(int i=2;i<=t;i++)
{
if(x%i==0)
{
v[x]=0;
return false;
}
}
v[x]=1;
return true;
}
else if(v[x]==0)return false;
else return true;
}
int lulalalulalalulalulalei(int x)
{
int ans=0,i=0;
int s[20];
while(x)
{
s[ans++]=x%10;
x/=10;
}
for(int i=0;i<=ans/2;i++)
if(s[i]!=s[ans-i-1])return 0;
return 1;
}
int main()
{
int n,m;
int i=m=n=0;
scanf("%d%d",&n,&m);
memset(v,-1,sizeof(v));
if(m>110000000)m=110000000;
for(i=n;i<=m;i++)
if(lulalalulalalulalulalei(i)&&lulalalulalalulalulahei(i))
printf("%d\n",i);
return 0;
}