88分求指点~~
查看原帖
88分求指点~~
546216
Zealots楼主2021/8/8 22:08
#include<bits/stdc++.h>
using namespace std;
int n,m,t,s,i,j,a[100000010];
int main() 
{
	cin>>n>>m;
	for(i=2;i<=sqrt(100000000);i++){
	    if(!a[i])
	       for(int j=i*i;j<=m;j+=i) 
	           a[j]=1;
	}
	for(j=n;j<=m;j++){
		t=j;
		while(t!=0){
			s=s*10+t%10;
			t/=10;
		}
		if(s==j){
			if(a[j]==0){
			   cout<<j<<endl;			
		    }
		}
		s=0;						
	}	
	return 0;
}
2021/8/8 22:08
加载中...