求助:为什么re了?

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

ceert @ 2023-03-04 07:19:04

#include<bits/stdc++.h>
using namespace std;
int a,b,f=1,t,zh=0,vis[19999999],prime[19999990];
int main()
{
    scanf("%d%d",&a,&b);
    for(int j=2;j*j<=b;j++)
    {
        if(vis[j]==0)
            for(int k=j+j;k<=b;k+=j)
                prime[k]=1;
    }
    for(int i=a;i<=b;i++)
    {
        f=1;t=i;zh=0;vis[i]=1;
        while(t)
        {
            zh=zh*10+t%10;
            t/=10;
        }
        if(zh==i&&prime[i]==0)
            printf("%d\n",zh);
    }
    return 0;
} 

by Pursuewind @ 2023-03-04 08:20:08

@ceert 数组开小了,是10^8,您开的大约是2 \times10^7


by ceert @ 2023-03-04 13:26:07

@wuyueton 谢谢 已关注


|