| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 79394 | 谢绍澜 | 寻找绝对素数 | C++ | Wrong Answer | 1 MS | 268 KB | 697 | 2024-07-04 19:29:41 |
#include<iostream> #include<cstring> using namespace std; int a(int x){ if (x<=1)return 0; for(int i=2;i*i<=x;i++){ if(x%i==0) return 0; } return 1; } bool fan(int n){ int mus=0; while(n!=0){ mus+=mus*10+n%10; n/=10; } return a(mus); } int main(){ int b,c; int e=0; cin>>b>>c; for(int j=b;j<=c;j++){ if(a(j)&&fan(j)){ e++; if(e==1) cout<<j; else cout<<","<<j; } } if(e==0) cout<<"No"; return 0; }
------Input------
1000 10999
------Answer-----
1009,1021,1031,1033,1061,1069,1091,1097,1103,1109,1151,1153,1181,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1279,1283,1301,1321,1381,1399,1409,1429,1439,1453,1471,1487,1499,1511,1523,1559,1583,1597,1601,1619,1657,1669,1723,1733,1741,1753,1789,1811,1831,1847,1867,1879,1901,1913,1933,1949,1979,3011,3019,3023,3049,3067,3083,3089,3109,3121,3163,3169,3191,3203,3221,3251,3257,3271,3299,3301,3319,3343,3347,3359,3371,3373,3389,3391,3407,3433,3463,3467,3469,3511,3527,3541,3571,3583,3613,3643,3697,
------Your output-----
1019,1033,1039,1181,1217,1297,1303,1321,1381,1453,1567,1783,1831,1871,1877,2063,2113,2207,2221,2267,2311,2333,2339,2371,2399,2441,2551,2591,2663,2711,2777,2843,2917,3079,3163,3217,3271,3299,3301,3323,3343,3389,3491,3541,3547,3581,3637,3659,3673,3761,3833,3851,3907,3923,3929,3989,4261,4283,4289,4339,4373,4421,4423,4481,4483,4517,4643,4663,4751,4801,4919,4951,4973,4999,5039,5059,5077,5147,5231,5279,5297,5323,5347,5419,5507,5527,5639,5693,5851,5879,5897,5923,6007,6029,6043,6089,6133,6203,6221,6247,