1 条题解

  • 0
    @ 2024-6-3 20:18:38

    怀疑PTA数据有误

    • 以下代码没过
    #include <bits/stdc++.h>
    using namespace std;
    const int N = 1e6 + 10, inf = 0x3f3f3f3f;
    int n, m, a[N];
    
    bool isp(int n) {
        for (int i = 2; i <= n / i; i++)
            if (n % i == 0)
                return 0;
        return n > 1;
    }
    int re(int n) {
        int t = 0;
        while (n)
            t = t * 10 + n % 10, n /= 10;
        return t;
    }
    int main() {
        ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
        cin >> n;
        for (int i = 2; i <= n; i++)
            if (isp(i) && isp(re(i)) && i != re(i))
                cout << i << " ";
        return 0;
    }
    
    • 1

    信息

    ID
    1269
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    7
    已通过
    3
    上传者