2023112626_duqunyao @ 2023-09-23 19:05:56
#include "stdio.h"
int huiwenshu(int k)
{
int l,m=0;
l=k;
while(l)
{
m=m*10+l%10;
l/=10;
}
if(m==k)
return 1;
else
return 0;
}
int zhishu(int j) {
if (j <= 1) {
return 0;
}
if (j <= 3) {
return 1;
}
if (j % 2 == 0 || j % 3 == 0) {
return 0;
}
for (int z = 5; z * z <= j; z += 6) {
if (j % z == 0 || j % (z + 2) == 0) {
return 0;
}
}
return 1;
}
int main()
{
int a,b;
fflush(stdout);
scanf("%d %d",&a,&b);
int m,n;
for(int i=a;i<=b;i++)
{
if(huiwenshu(i)==1)
{
if(zhishu(i)==1)
printf("%d\n",i);
}
}
return 0;
}
最后一个超时
by 123WRz @ 2023-10-06 14:25:49
判断位数