2 solutions

  • 3
    @ 2026-3-28 16:10:58

    #include <bits/stdc++.h> using namespace std; int S; int ma;

    bool check(int n) { if (n < 2) return false; for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; }

    int main() { cin >> S; for (int i = 1; i <= S; ++i) if (check(i)) if (check(S - i)) if (i * (S - i) > ma) ma = i * (S - i); cout << ma; return 0; }

    Information

    ID
    12095
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    8
    Accepted
    7
    Uploaded By