最后三个TEl,佬救救

P1217 [USACO1.5] 回文质数 Prime Palindromes

LUFEE666 @ 2023-09-27 22:40:58

#include<stdio.h>
#include<math.h>
bool isprime(int x){

    for(int i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
        {
            return false;
        }

    }
    return true;
}
bool huiwen(int x)
{
    int c=0;
    while (x>c)
    {
        c=c*10+x%10;
        x/=10;
    }
    return x==c||x==c/10;
}
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a%2==0)
    {
        a+=1;
    }
    for(a;a<=b;a+=2)
    {
        if(a%2==0)
        {
            continue;
        }
        if(isprime(a)&&huiwen(a))
        {
            printf("%d\n",a);
        }
    }
    return 0;
}

![]()


by Jianbing_Juan @ 2023-09-27 23:02:25

试试改inline,开吸氧,快速输出


|