Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
118709 | 刘轻松 | 寻找绝对素数 | C++ | Wrong Answer | 1 MS | 268 KB | 558 | 2025-05-10 10:58:25 |
#include<bits/stdc++.h> using namespace std; //反序数 int FanXuShu(int a){ int b=0; while(a!=0){ b = b*10+ a%10; a = a/10; } return b; } bool SuShu(int x){ if(x==2) return 1; for(int j=2;j<=sqrt(x);j++){ if(x%j==0) return 0; } return 1; } int main(){ int m,n,k; int f=0; cin>>m>>n; for(int i=m;i<=n;i++){ k = FanXuShu(i); //求i的反序数 if(SuShu(i) && SuShu(k)){ if(f==0){ cout<<i; f++; } else{ cout<<","<<i; } } } if(f==0){ cout<<"No"; } }
------Input------
1 10
------Answer-----
2,3,5,7
------Your output-----
1,2,3,5,7