Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7333 | 黄宜洋 | 寻找绝对素数 | C++ | Wrong Answer | 1 MS | 268 KB | 815 | 2025-04-19 15:49:15 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; bool Isprime(int x){ if(x<2) return false; for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ return false; } } return true; } int rev(int x){ int n=x,ans; while(n!=0){ ans=ans*10+n%10; n/=10; } return ans; } int main(){ int m,n; bool f=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(Isprime(i)&&Isprime(rev(i))){ if(f==0) cout<<i; else cout<<","<<i; f=1; } } if(f=0) cout<<"No"<<endl; return 0; }
------Input------
20 28
------Answer-----
No
------Your output-----