Run ID:79395
提交时间:2024-07-04 19:37:20
#include<iostream> #include<cstring> using namespace std; bool a(int x){ if (x<=1)return false; for(int i=2;i*i<=x;i++){ if(x%i==0) return false; } return true; } bool fan(int n){ int mus=0; while(n!=0){ mus=mus*10+n%10; n/=10; } return a(mus); } int main(){ int b,c; int e=0; cin>>b>>c; for(int j=b;j<=c;j++){ if(a(j)&&fan(j)){ e++; if(e==1) cout<<j; else cout<<","<<j; } } if(e==0) cout<<"No"; return 0; }