midsummer_zyl @ 2023-07-09 17:14:14
大佬帮帮忙!
#include <bits/stdc++.h>
using namespace std;
int ss(int x) {
if(x <= 1)
return 0;
if(x == 2)
return 1;
for (int i = 2; i < x; i++)
if(x % i == 0)
return 0;
return 1;
}
int main() {
long long n, m, s = 0;
scanf("%lld%lld", &n, &m);
for (long long i = n; i <= m; i++) {
long long j = i;
s = 0;
while (j != 0) {
s = s * 10 + j % 10;
j /= 10;
}
if(s == i && ss(i) == 1)
printf("%lld\n", i);
}
return 0;
}
by midsummer_zyl @ 2023-07-09 18:42:34
ok
谢谢大佬