Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114846 | 刘珩宇 | 寻找绝对素数 | C++ | Accepted | 11 MS | 272 KB | 731 | 2025-03-23 18:52:06 |
#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; int out(int x){ if(x<=1){ return 0; } for(int i=2;i*i<=x;i++){ if(x%i==0){ return 0; } } return 1; } int re(int y){ int s=0; while(y!=0){ s=s*10+y%10; y/=10; } return out(s); } int main(){ int n,m,s=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(re(i)==1&&out(i)==1){ if(s==0){ cout<<i; s++; } else{ cout<<","<<i; } } } if(s==0){ cout<<"No"; } return 0; }