ce求助
查看原帖
ce求助
760712
_fox_楼主2023/9/10 11:35
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
bool sh(int x){
	if(x<2){
		return 0;
	}
	else{
		for(int i=2;i<x;i++){
			if(x%i==0){
				return 0;
			}
		}
	}
	return 1;
}
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=n;i<m;i++){
		if(sh(i)==1){
			string t;
			t=to_string(i);
			if(reverse(t.begin(),t.end())==t){
				cout<<i<<' '; 
			}
		}
	}
	
	return 0;
}
2023/9/10 11:35
加载中...