21 条题解

  • -4
    @ 2022-1-11 10:23:31
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int main()
    {
        int n;
        cin >> n;
        int sum = 0;
        for(int i = 3 ; i + 2 <= n ; i += 2)
        {
            int flag = 1;
            for(int j = 2; j*j <= i ; j++)
            {
                if(i%j == 0)
                {
                    flag = 0;
                    break;
                }
            }
            if(flag == 0)
            {
                sum++;
                cout << i << " " << i + 2 << endl;
            }
        }
        if(sum==0)
        {
            cout << "empty\n";
        }
        return 0;
    }```

    信息

    ID
    946
    时间
    1000ms
    内存
    128MiB
    难度
    7
    标签
    (无)
    递交数
    1290
    已通过
    346
    上传者