Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 509;
- int a[N];
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- // freopen("/home/hamoudi/Coding/run.in", "r", stdin);
- int tt = 1;
- // cin >> tt;
- while (tt--) {
- int n;
- cin >> n;
- // in this case it will be impossible to find 2 primes such that their summation is equal to n
- if (n <= 3) {
- cout << -1;
- } else {
- // i will assume that i can find a solution
- // i need to check about n - 2 (where (n - 2) is prime or not)
- // 2 + (n - 2) = n so i can fulfill the condition
- bool found = true;
- for (int i = 2; i <= sqrt(n - 2); ++i) {
- if ((n - 2) % i == 0) {
- // it can't be a prime in this case
- found = false;
- break;
- }
- }
- if (not found)
- cout << -1;
- else
- cout << 2 << " " << n - 2;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement