Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
118710 | 刘佳宇 | 寻找绝对素数 | C++ | Wrong Answer | 1 MS | 264 KB | 500 | 2025-05-10 10:58:34 |
#include<bits/stdc++.h> using namespace std; int fxs(int a){ int b=0; while(a!=0){ b=b*10+a%10; a=a/10; } return b; } bool sushu(int w){ if(w==2) return 1; for(int j=2;j<=sqrt(w);j++){ if(w%j==0){ return 0; } } return 1; } int main(){ int m,n,k,f=0; cin>>m>>n; for(int i=m;i<=n;i++){ k=fxs(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