Run ID:154184

提交时间:2026-05-24 16:19:23

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int s(int x){ if(x==1){ return 0; } for(int i=2;i*i<=x;i++){ if(x%i==0){ return 0; } } return 1; } int n(int x){ int y=0; while(x!=0){ y=x%10+y*10; x/=10; } return y; } int main(){ int a,b,c=1; cin>>a>>b; for(int i=a;i<=b;i++){ if(s(i)==1&&s(n(i))==1){ if(c==1){ cout<<i; c++; } else{ cout<<','<<i; } } } if(c==1){ cout<<"No"; } return 0; }