#include <bits/stdc++.h> using namespace std; int main() { long long k, n, sum = 0; bool flag = true;
for (long long i = 100; i <= 1000; i++) { k = i; while (k) { sum = sum * 10 + k % 10; k = k / 10; } if (sum == i) { n = sum; for (long long c = 2; c <= sqrt(n); c++) { if (n % c == 0) { flag = false; } }
} else flag = false; if (flag == true) { cout << n << endl; } sum = 0; n = 0; flag = true;
}
return 0;
}
共 1 条回复
大错特错