哪里慢了T-T,求大佬指点

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

nbq202412904430 @ 2024-09-12 13:31:35

#include<stdio.h>
int main()
{
    int a,b,k,s=0;
    int d[120];
    scanf("%d%d",&a,&b);
    for(int i=a;i<=b;i++)
    {
        int isprine=0;
        int c=i;
        for(k=1;;k++)
        {
            d[k]=c%10;
            c=c/10;
            if(c==0)break;
        }
        for(int f=1;k>0;f++,k--)
        {
            if(d[f]!=d[k])isprine=1;
        }
        for(int j=2;j<i;j++)
        {
            if(i%j==0)
            {
                isprine=1;
                break;
            }
        }
        if(isprine==1)continue;
        if(s<2)s++;
        if(s!=1)printf("\n");
        printf("%d",i);

    }
    return 0;
 } 

by dongzirui0817 @ 2024-09-12 13:33:07

@nbq202412904430 hack:

1 100000000

by nbq202412904430 @ 2024-09-12 13:45:50

@dongzirui0817 没看懂,不知道该怎么更正


by dongzirui0817 @ 2024-09-12 21:56:07

@nbq202412904430 做法假了,建议去看题解


|