Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
86334 | Kevin | 寻找绝对素数 | C++ | Accepted | 13 MS | 264 KB | 500 | 2024-07-24 16:04:05 |
#include<bits/stdc++.h> using namespace std; bool ss(int n){ if(n<=1) return false; if(n==2) return true; for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } int qf(int y){ int q=0; while(y>0){ q=q*10+y%10; y/=10; } return q; } int main(){ int m,n,t=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(ss(i)&&ss(qf(i))) { t++; if(t==1) cout<<i; else cout<<","<<i; } } if(t==0) cout<<"No"; return 0; }