hailong126 @ 2022-09-08 20:59:46
#include<stdio.h>
#include<bits/stdc++.h>
const int MAXN = 100000001;
int prime[MAXN];
void Prime()
{
for (int i=0; i<MAXN; i++) prime[i]=1;
prime[0]=prime[1]=0;
for (int i=2; i<MAXN; i++)
{
if (!prime[i]) continue;
for (int j=i*2; j<MAXN; j+=i)
prime[j] = 0;
}
}
int main(){
int a,b;
Prime();
scanf("%d%d",&a,&b);
int data=0;
int dao=0;
for(int i=a;i<=b;i++){
if(i<10){
if(prime[i]) printf("%d\n",i);
}else{
data=i;
dao=0;
while(data!=0){
dao=dao*10+data%10;
data=data/10;
}
if(dao==i && prime[i]){
printf("%d\n",i);
}
}
}
return 0;
}
求助,打表全超内存
by zlc_521 @ 2022-09-25 17:17:31
一定不是质数