Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
79395 谢绍澜 寻找绝对素数 C++ Accepted 10 MS 272 KB 724 2024-07-04 19:37:20

Tests(10/10):


Code:

#include<iostream> #include<cstring> using namespace std; bool a(int x){ if (x<=1)return false; for(int i=2;i*i<=x;i++){ if(x%i==0) return false; } return true; } bool fan(int n){ int mus=0; while(n!=0){ mus=mus*10+n%10; n/=10; } return a(mus); } int main(){ int b,c; int e=0; cin>>b>>c; for(int j=b;j<=c;j++){ if(a(j)&&fan(j)){ e++; if(e==1) cout<<j; else cout<<","<<j; } } if(e==0) cout<<"No"; return 0; }