Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132969 李馥甄 寻找绝对素数 C++ Accepted 13 MS 268 KB 561 2025-10-12 18:09:40

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int N,M; bool sushu(int k){ if(k<2){ return false; } for(int i=2;i*i<=k;i++){ if(k%i==0){ return false; } } return true; } int fanxu(int m){ int r=0; while(true){ int d=m%10; m/=10; r=r*10+d; if(m==0){ return r; } } } int main(){ cin>>M>>N; int cnt=0; for(int a=M;a<=N;a++){ if(sushu(a)==true&&sushu(fanxu(a))==true){ cnt++; if(cnt==1){ cout<<a; }else{ cout<<","<<a; } } } if(cnt==0){ cout<<"No"; } return 0; }