66分求调
查看原帖
66分求调
1427588
zhou_yu_cheng楼主2025/8/1 21:58
#include<bits/stdc++.h>
using namespace std;
int l,r;
bool p(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}
bool f(int n){
	int m=0,t=n;
	while(t!=0){
		m*=10;
		m+=t%10;
		t/=10;
	}
	if(m==n){
		return true;
	}
	else{
		return false;
	}
}
int main(){
	cin>>l>>r;
	for(int i=l;i<=r;i++){
		if(p(i)&&f(i)){
			cout<<i<<"\n";
		}
	}
	return 0;
}
2025/8/1 21:58
加载中...