wzy091030 @ 2023-04-21 21:00:47
#include <bits/stdc++.h>
using namespace std;
bool ac(int a)
{int sum=0,q,c;
c=a;
while(a>0)
{
q=a%10;
a=a-q;
a=a/10;
sum=sum*10+q;
}
if(sum==c)
return true;
else
return false;
}
bool sh(int a){
for(int i=2;i<=sqrt(a);i++)
{
if (a%i==0) return false;
}
return true;
}
int main()
{
int m,n;
scanf("%d %d",&m,&n);
//cin>>m>>n;
if(m%2==0) m=m+1;
for(int i=m;i<=n;i=i+2)
{
if(sh(i)==1&&ac(i)==1)
//cout<<i<<endl;
printf("%d\n",i);
}
return 0;
}
by hzibkfdwfioh @ 2023-04-29 13:50:22
@chenkuochenkuo ok,明白了,谢了,大佬