Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
87609 | 万隽宇 | 寻找绝对素数 | C++ | Accepted | 10 MS | 272 KB | 689 | 2024-08-10 20:35:11 |
#include<iostream>//0=65 #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; } int b(int y){ int c=0; while(y!=0){ c=c*10+y%10; y=y/10; } return a(c); } int main(){ int m,n,d=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(a(i) && b(i)){ d++; if(d==1) cout<<i; else cout<<","<<i; } } if(d==0){ cout<<"No"; } cout<<endl; return 0; }