Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95719 | 任斌 | 寻找绝对素数 | C++ | Accepted | 11 MS | 268 KB | 479 | 2024-11-02 10:15:12 |
#include<bits/stdc++.h> using namespace std; bool ss(int s){ if(s<=1) return false; for(int i=2;i<=sqrt(s);i++){ if(s%i==0) return false; } return true; } int fx(int x){ int box=0; while(x){ box=box*10+x%10; x/=10; } return box; } int main() { int m,n,sum=0; cin>>m>>n; for(int p=m;p<=n;p++){ if(ss(p) && ss(fx(p))){ sum++; if(sum==1) cout<<p; else cout<<","<<p; } } if(sum==0)cout<<"No"<<endl; return 0; }