yuyuyuyu12345 @ 2022-10-11 15:28:54
#include <iostream>
#include <cmath>
using namespace std;
bool check1(int x)//检查位数
{
if((1000 <= x && x <= 9999) || (100000 <= x && x <= 999999)) return 0;//不知道&&和||优先级的可以打个括号
return 1;
}
bool huiwen(int x)
{
int h=x;
if(x<=9) return 1;
int y=0;
while(x>0)
{
y*=10;
y+=x%10;
x/=10;
}
if(y==h)return 1;
else return 0;
}
bool isprime(int x)
{
if(x<=2) return 0;
for(int i=2;i<=sqrt(x);i++)
{
if(x%i==0) return 0;
}
return 1;
}
int main()
{
int n,m;
cin>>n>>m;
if(n%2==0) n++;
for(int i=n;i<=m;i+=2)
{
if(check1(i)&&isprime(i)&&huiwen(i)) cout<<i<<"\n";
}
}