jiangyixuan_eason @ 2024-08-29 13:07:10
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n){
bool x=true;
for(int i=2;i<n;i++){
if(n%i==0){
x=false;
break;
}
}
return x;
}
bool palindromes(int n){
string s1=to_string(n);
string s2=to_string(n);
reverse(s1.begin(),s1.end());
if(s1 == s2){
return true;
}
return false;
int j=s1.size();
int m=n%10*pow(10,j-1);
for(int i=1;i<j;i++){
int t=pow(10,i);
m+=n/t%10*pow(10,j-1-i);
}
if(m==n){
return true;
}
else{
return false;
}
}
int main(){
int a,b;
cin >>a>>b;
for(int i=a;i<=b;i++){
if(isPrime(i)){
if(palindromes(i)){
cout <<i<<endl;
}
}
}
return 0;
}
by chengjindong @ 2024-08-29 13:35:03
额
by chengjindong @ 2024-08-29 13:35:28
蟹蟹,回了
by jiangyixuan_eason @ 2024-08-29 13:50:22
已关
by 202312900205fjc @ 2024-09-02 21:01:47
@chengjindong 大佬
by chengjindong @ 2024-09-03 16:47:19
@202312900205fjc 啊?