Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140702 翁思宸 寻找绝对素数 C++ Accepted 10 MS 276 KB 759 2025-12-19 19:02:09

Tests(10/10):


Code:

//1500 寻找绝对素数 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int use(int x){ int s=0; while(x!=0){ s=s*10+x%10; x/=10; } return s; } int use1(int x){ if(x<2){ return 0; } for(int i=2;i*i<=x;i++){ if(x%i==0){ return 0; } } return 1; } int main(){ int m,n,zoom=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(use1(i)==1 && use1(use(i))==1){ zoom++; if(zoom==1){ cout<<i; } else { cout<<","<<i; } } } if(zoom==0){ cout<<"No"; } return 0; }