答案

skvm 2021-11-05 15:34:50 2021-11-05 15:36:12 11

#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 &lt;&lt; n &lt;&lt; endl;
}

sum = 0;
n = 0;
flag = true;

}

return 0;

}

{{ vote && vote.total.up }}

共 1 条回复

zhengchenhao1

大错特错