Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154184 顾文博 寻找绝对素数 C++ Accepted 14 MS 276 KB 852 2026-05-24 16:19:23

Tests(10/10):


Code:

#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 s(int x){ if(x==1){ return 0; } for(int i=2;i*i<=x;i++){ if(x%i==0){ return 0; } } return 1; } int n(int x){ int y=0; while(x!=0){ y=x%10+y*10; x/=10; } return y; } int main(){ int a,b,c=1; cin>>a>>b; for(int i=a;i<=b;i++){ if(s(i)==1&&s(n(i))==1){ if(c==1){ cout<<i; c++; } else{ cout<<','<<i; } } } if(c==1){ cout<<"No"; } return 0; }