KevinTYX @ 2024-10-07 19:19:32
#include <bits/stdc++.h>
using namespace std;
bool x(int a)
{
for(int i=2;i<a;i++)
{
if(a%i==0)
{
return 0;
}
}
return 1;
}
bool y(int a)
{
int f=a;
int sum=0;
while(a)
{
sum*=10;
sum+=a%10;
a/=10;
}
if(sum==f)
{
return 1;
}
return 0;
}
int main()
{
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(x(i))
{
if(y(i))
{
cout<<i<<endl;
}
}
}
return 0;
}
by chx_happy @ 2024-10-07 19:51:47
@OIerbcx 其实三处都改也不对,质数筛我正在试
by OIer_bcx_ @ 2024-10-07 19:57:13
@chx_happy ? A了
by chx_happy @ 2024-10-07 20:09:53
@KevinTYX 开C++14(GCC 9)
by KevinTYX @ 2024-10-08 21:28:13
谢!^-^