Zhang_Yi_Jian @ 2024-11-28 15:46:21
#include <iostream>
using namespace std;
bool is_palin(int n)
{
int n1, n2;
for(n1 = n, n2 = 0; n1 != 0; n1 /= 10)
{
n2 = 10 * n2 + n1 % 10;
}
if(n2 == n) return true;
else return false;
}
bool is_prime(int x)
{
if(x == 1 || x == 0)
{
return false;
}
for(int i = 2; i * i <= x; i++)
{
if(x % i == 0) return false;
}
return true;
}
int main()
{
int a, b;
cin >> a >> b;
for(int i = a; i <= b; i++)
{
if(is_palin(i))
{
if(is_prime(i)) cout << i << endl;
}
else continue;
}
return 0;
}
//烦请各位大佬指点
by cjy0329 @ 2024-12-01 19:42:15