m3o7o2n1 @ 2024-02-06 18:25:10
#include <stdio.h>
int ws(int x){
if(x>=10&&x<=100)return 2;
if(x>=1000&&x<=10000)return 2;
if(x>=100000&&x<=1000000)return 2;
if(x>=10000000&&x<=100000000)return 2;
return 1;
}
int os(int x){
if(x%2==0)return 2;
return 1;
}
int ss(int x){
int i;
for(i=1;i<x;i++){
if(x%i==0&&i!=1){
return 2;
break;}
return 1;
}}
int hw(int x){
int y,sum=0;
int k;
k=x;
while(x!=0){
y=x%10;
sum=sum*10+y;
x=x/10;
}
if(k==sum)return 1;
else return 2;
}
int main(){
int a,b,i,w,o,s,j=0,m=0,n=0,wso[10000000000],oso[10000000000],sso[10000000000];
int h;
scanf("%d %d",&a,&b);
for(i=a;i<=b;i++){
w=ws(i);
if(w!=2){
wso[j]=i;
j++;
}
}
for(i=0;i<j;i++){
o=os(wso[i]);
if(o!=2){
oso[m]=wso[i];
m++;
}
}
for(i=0;i<m;i++){
s=ss(oso[i]);
if(s!=2){
sso[n]=oso[i];
n++;
}
}
for(i=0;i<n;i++){
h=hw(sso[i]);
if(h!=2)printf("%d\n",sso[i]);
}
return 0;
}
by OJ_killer @ 2024-02-06 18:36:00
1.数组上限3·10^7 2.数组太大要开在主函数外部