有一个测试点死活过不去

#include <iostream>

using namespace std;

bool ss(int x)
{
    if (x < 2) return 0;

    for (int i = 2;i < x;i ++)
        if (x%i == 0) return 0;

    return 1;
}

int main ()
{
    int s;
    cin >> s;

    s /= 2;
    //cout << s;
    for (int i = 1;i <= s-2;i ++)
    //if (ss(s-i)) cout << s-i << " " << s+i << "\n";
    if (ss(s-i) && ss(s+i))
    {
        cout << (s+i) * (s-i) << "\n";
        return 0;
    }
    return 0;
}

0 comments

No comments so far...

Information

ID
651
Time
1000ms
Memory
256MiB
Difficulty
7
Tags
(None)
# Submissions
27
Accepted
9
Uploaded By