| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 154181 | 顾文博 | 寻找绝对素数 | C++ | Wrong Answer | 2 MS | 268 KB | 768 | 2026-05-24 16:16:59 |
#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){ 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; } } } return 0; }
------Input------
1 10
------Answer-----
2,3,5,7
------Your output-----
1,2,3,5,7