为什么全WA了
查看原帖
为什么全WA了
1127126
yueyan_WZF楼主2023/11/4 17:11
#include<bits/stdc++.h>
using namespace std;
int zhishu(int e){
	for(int i=2;i<sqrt(e);i++){
		if(e%i==0){
			return 2;
		}
	}
	return 1;
}

int huiwen(int e){
	int a[100];
	int t=e,i=1;
	while(t>0){
		a[i]=t%10;
		t=t/10;
		i++;
	}
	for(int j=1,p=i-1;j<i,p>=1;j++,p--){
		if(a[j]!=a[p]){
			return 2;
		}
	}
	return 1;
}
int main(){
	int a,b,ans=0;
	cin>>a;
	for(int i=11;i<=a;i++){
		if(huiwen(i)==1&&zhishu(i)==1){
			ans++;
		}
	}
	cout<<ans;
}
2023/11/4 17:11
加载中...