我的思路:先判断是不是回文,在判断是不是质数。
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++){
int m=0;
int n=i;
while(n>0){
m=n%10+m*10;
n=n/10;
}
if(m==i){
for(int u=2;u<i;u++){
if(i%u==0)break;
if(i%u!=0&&i-u==1)cout<<i<<" "<<endl;
}
}
}
return 0;
}