WA!!!
查看原帖
WA!!!
1638140
chang20140130楼主2025/1/30 09:16

为什么WA掉了???!

大佬求救!!!

感谢大佬!!!

#include<bits/stdc++.h>
using namespace std;
int a,b;
bool weishu(int x){
	if(1000<=x&&x<=9999||100000<=x&&x<=999999){
		return false;	
	}
	else{
		return true;
	}	 
}
bool ishuiwenshu(int x){
	int a[20],flag=1;
	while(x>0){
		a[flag]=x%10;
		x/=10;
		flag++;
	} 
	for(int i=1;i<=flag/2;i++){
		if(a[i]!=a[flag-i]){
			return false;			
		}
	}
	return true;
} 
bool iszhishu(int x){
	if(x>=2){
		return true;
		for(int i=2;i<=sqrt(x);i++){
			if(x%i==0){
				return false;
				break;
			}
		}
	}
	return true;
}
int main(){
	cin>>a>>b;
	if(a==2){
		cout<<2<<endl;
	}
	if(a%2==0){
		a++;
	}
	b=min(99999999,b);
	for(int i=a;i<=b;i+=2){
		if(weishu(i)==0){
			continue;
		}
		if(ishuiwenshu(i)==0){
			continue;
		}
		if(iszhishu(i)==0){
			continue;
		}
		printf("%d\n",i);
	}
    return 0;
}

//感谢审核!!!
2025/1/30 09:16
加载中...