44 lines
810 B
C++
44 lines
810 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int primes[2001];
|
|
|
|
bool is_prime(int a) {
|
|
for (int i = 2; i * i <= a; i++) {
|
|
if (a % i != 0) {
|
|
continue;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void init_primes() {
|
|
int current_num = 2, i = 0;
|
|
for (;; current_num++) {
|
|
if (is_prime(current_num)) {
|
|
primes[i] = current_num;
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(false);
|
|
cin.tie(nullptr);
|
|
int a;
|
|
cin >> a;
|
|
if (a % 2 != 0 || a < 6) {
|
|
cout << "Error!" << endl;
|
|
} else
|
|
for (int i = 0; primes[i] <= a / 2; i++) {
|
|
if (is_prime(a - primes[i])) {
|
|
cout << a << "=" << i << "+" << a - i << endl;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|