Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
91384 | 刘世杰 | 寻找绝对素数 | C++ | Wrong Answer | 1 MS | 268 KB | 555 | 2024-09-21 17:27:22 |
#include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int cnt = 0; int s1(int x){ if(x == 1) return 0; for(int i = 2;i * i <= x;i++) if(!(x % i)) return 0; return 1; } int main(){ int m,n; cin >> m >> n; for(int i = m;i <= n;i++){ int ge = i % 10; int shi = i / 10; if(s1(i) && s1(10 * ge + shi)){ cnt++; if(cnt == 1) cout << i; else cout << "," << i; } } 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-----
1013,1019,1031,1039,1093,1097,1117,1171,1193,1213,1217,1237,1277,1291,1297,1373,1399,1433,1439,1471,1493,1499,1531,1571,1597,1613,1619,1637,1693,1697,1811,1831,1871,1877,1879,1933,1973,1993,1997,2011,2017,2039,2113,2131,2137,2179,2213,2237,2239,2273,2311,2333,2377,2393,2411,2417,2437,2473,2477,2531,2579,2591,2617,2633,2671,2677,2699,2711,2731,2777,2797,2833,2837,2897,2939,2971,2999,3011,3037,3079,3119,3137,3271,3299,3319,3371,3373,3391,3433,3491,3499,3517,3533,3539,3571,3593,3617,3631,3637,3673,